diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index a8850b8f..acfced64 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -284,6 +284,7 @@ tile.trap.barricade.spruce.name=Spruce Barricade tile.trap.barricade.birch.name=Birch Barricade tile.trap.barricade.jungle.name=Jungle Barricade tile.extractor.essence.name=Essence Extractor +tile.explosive.slime.name=SDX StorageMetals.Cobalt.name=Block of Cobalt StorageMetals.Ardite.name=Block of Ardite diff --git a/resources/assets/tinker/textures/blocks/sdx_bottom_blue.png b/resources/assets/tinker/textures/blocks/sdx_bottom_blue.png new file mode 100644 index 00000000..95f6f0f2 Binary files /dev/null and b/resources/assets/tinker/textures/blocks/sdx_bottom_blue.png differ diff --git a/resources/assets/tinker/textures/blocks/sdx_bottom_green.png b/resources/assets/tinker/textures/blocks/sdx_bottom_green.png new file mode 100644 index 00000000..0f13280a Binary files /dev/null and b/resources/assets/tinker/textures/blocks/sdx_bottom_green.png differ diff --git a/resources/assets/tinker/textures/blocks/sdx_side_blue.png b/resources/assets/tinker/textures/blocks/sdx_side_blue.png new file mode 100644 index 00000000..f6a74e3d Binary files /dev/null and b/resources/assets/tinker/textures/blocks/sdx_side_blue.png differ diff --git a/resources/assets/tinker/textures/blocks/sdx_side_green.png b/resources/assets/tinker/textures/blocks/sdx_side_green.png new file mode 100644 index 00000000..09421f69 Binary files /dev/null and b/resources/assets/tinker/textures/blocks/sdx_side_green.png differ diff --git a/resources/assets/tinker/textures/blocks/sdx_top_blue.png b/resources/assets/tinker/textures/blocks/sdx_top_blue.png new file mode 100644 index 00000000..102118eb Binary files /dev/null and b/resources/assets/tinker/textures/blocks/sdx_top_blue.png differ diff --git a/resources/assets/tinker/textures/blocks/sdx_top_green.png b/resources/assets/tinker/textures/blocks/sdx_top_green.png new file mode 100644 index 00000000..c729d22c Binary files /dev/null and b/resources/assets/tinker/textures/blocks/sdx_top_green.png differ diff --git a/resources/assets/tinker/textures/items/tinkerbook_blue.png b/resources/assets/tinker/textures/items/tinkerbook_blue.png index cbe019a2..8a1fe830 100644 Binary files a/resources/assets/tinker/textures/items/tinkerbook_blue.png and b/resources/assets/tinker/textures/items/tinkerbook_blue.png differ diff --git a/resources/assets/tinker/textures/items/tinkerbook_diary.png b/resources/assets/tinker/textures/items/tinkerbook_diary.png index ecfdbad2..7b823f25 100644 Binary files a/resources/assets/tinker/textures/items/tinkerbook_diary.png and b/resources/assets/tinker/textures/items/tinkerbook_diary.png differ diff --git a/resources/assets/tinker/textures/items/tinkerbook_green.png b/resources/assets/tinker/textures/items/tinkerbook_green.png index cd1ffd39..e73dd2b4 100644 Binary files a/resources/assets/tinker/textures/items/tinkerbook_green.png and b/resources/assets/tinker/textures/items/tinkerbook_green.png differ diff --git a/resources/assets/tinker/textures/items/tinkerbook_smeltery.png b/resources/assets/tinker/textures/items/tinkerbook_smeltery.png index cd958904..f285203b 100644 Binary files a/resources/assets/tinker/textures/items/tinkerbook_smeltery.png and b/resources/assets/tinker/textures/items/tinkerbook_smeltery.png differ diff --git a/resources/assets/tinker/textures/items/tinkerbook_toolstation.png b/resources/assets/tinker/textures/items/tinkerbook_toolstation.png index 35420beb..5897ae95 100644 Binary files a/resources/assets/tinker/textures/items/tinkerbook_toolstation.png and b/resources/assets/tinker/textures/items/tinkerbook_toolstation.png differ diff --git a/src/tconstruct/blocks/SlimeExplosive.java b/src/tconstruct/blocks/SlimeExplosive.java new file mode 100644 index 00000000..aee9cea8 --- /dev/null +++ b/src/tconstruct/blocks/SlimeExplosive.java @@ -0,0 +1,148 @@ +package tconstruct.blocks; + +import java.util.List; + +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import net.minecraft.world.Explosion; +import net.minecraft.world.World; +import tconstruct.entity.item.ExplosivePrimed; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class SlimeExplosive extends TConstructBlock +{ + + public SlimeExplosive(int id) + { + super(id, Material.tnt, 0f, getTextureNames()); + } + + static String[] getTextureNames () + { + String[] names = new String[6]; + String[] types = new String[] { "green", "blue" }; + for (int i = 0; i < 2; i++) + { + names[i * 3 + 0] = "sdx_bottom_" + types[i]; + names[i * 3 + 1] = "sdx_side_" + types[i]; + names[i * 3 + 2] = "sdx_top_" + types[i]; + } + return names; + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getIcon (int side, int meta) + { + return icons[(meta / 2) * 3 + getSideTextureIndex(side)]; + } + + @Override + public void getSubBlocks (int id, CreativeTabs tab, List list) + { + for (int iter = 0; iter < 2; iter++) + { + list.add(new ItemStack(id, 1, iter * 2)); + } + } + + @Override + public void onBlockAdded (World par1World, int par2, int par3, int par4) + { + super.onBlockAdded(par1World, par2, par3, par4); + + if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); + par1World.setBlockToAir(par2, par3, par4); + } + } + + @Override + public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, int par5) + { + if (par1World.isBlockIndirectlyGettingPowered(par2, par3, par4)) + { + this.onBlockDestroyedByPlayer(par1World, par2, par3, par4, 1); + par1World.setBlockToAir(par2, par3, par4); + } + } + + @Override + public void onBlockDestroyedByExplosion (World par1World, int par2, int par3, int par4, Explosion par5Explosion) + { + if (!par1World.isRemote) + { + ExplosivePrimed entitytntprimed = new ExplosivePrimed(par1World, (double) ((float) par2 + 0.5F), (double) ((float) par3 + 0.5F), (double) ((float) par4 + 0.5F), + par5Explosion.getExplosivePlacedBy()); + entitytntprimed.fuse = par1World.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8; + par1World.spawnEntityInWorld(entitytntprimed); + } + } + + @Override + public void onBlockDestroyedByPlayer (World par1World, int par2, int par3, int par4, int par5) + { + this.primeTnt(par1World, par2, par3, par4, par5, (EntityLivingBase) null); + } + + public void primeTnt (World par1World, int par2, int par3, int par4, int par5, EntityLivingBase par6EntityLivingBase) + { + if (!par1World.isRemote) + { + if ((par5 % 2) == 1) + { + ExplosivePrimed entitytntprimed = new ExplosivePrimed(par1World, (double) ((float) par2 + 0.5F), (double) ((float) par3 + 0.5F), (double) ((float) par4 + 0.5F), par6EntityLivingBase); + par1World.spawnEntityInWorld(entitytntprimed); + par1World.playSoundAtEntity(entitytntprimed, "random.fuse", 1.0F, 1.0F); + } + } + } + + @Override + public boolean onBlockActivated (World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) + { + if (par5EntityPlayer.getCurrentEquippedItem() != null && par5EntityPlayer.getCurrentEquippedItem().itemID == Item.flintAndSteel.itemID) + { + this.primeTnt(par1World, par2, par3, par4, 1, par5EntityPlayer); + par1World.setBlockToAir(par2, par3, par4); + par5EntityPlayer.getCurrentEquippedItem().damageItem(1, par5EntityPlayer); + return true; + } + else + { + return super.onBlockActivated(par1World, par2, par3, par4, par5EntityPlayer, par6, par7, par8, par9); + } + } + + @Override + public void onEntityCollidedWithBlock (World par1World, int par2, int par3, int par4, Entity par5Entity) + { + if (par5Entity instanceof EntityArrow && !par1World.isRemote) + { + EntityArrow entityarrow = (EntityArrow) par5Entity; + + if (entityarrow.isBurning()) + { + this.primeTnt(par1World, par2, par3, par4, 1, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null); + par1World.setBlockToAir(par2, par3, par4); + } + } + } + + @Override + public boolean canDropFromExplosion (Explosion par1Explosion) + { + return false; + } + +} diff --git a/src/tconstruct/blocks/TConstructBlock.java b/src/tconstruct/blocks/TConstructBlock.java index d7d19675..0a8b0ac5 100644 --- a/src/tconstruct/blocks/TConstructBlock.java +++ b/src/tconstruct/blocks/TConstructBlock.java @@ -50,6 +50,17 @@ public class TConstructBlock extends Block { return meta < icons.length ? icons[meta] : icons[0]; } + + @SideOnly(Side.CLIENT) + public int getSideTextureIndex (int side) + { + if (side == 0) + return 2; + if (side == 1) + return 0; + + return 1; + } @Override public void getSubBlocks (int id, CreativeTabs tab, List list) diff --git a/src/tconstruct/blocks/component/SmelteryComponent.java b/src/tconstruct/blocks/component/SmelteryComponent.java index de38c122..513876f6 100644 --- a/src/tconstruct/blocks/component/SmelteryComponent.java +++ b/src/tconstruct/blocks/component/SmelteryComponent.java @@ -102,7 +102,7 @@ public class SmelteryComponent extends LogicComponent hasUse = true; if (activeTemps[i] < maxTemp && activeTemps[i] < meltingTemps[i]) { - activeTemps[i] += 1; + activeTemps[i] += 100; } else if (activeTemps[i] >= meltingTemps[i] && !world.isRemote) { diff --git a/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java b/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java index 26f1b266..f4b0909a 100644 --- a/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java +++ b/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java @@ -44,7 +44,7 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc SmelteryScan structure = new SmelteryScan(this, TContent.smeltery, TContent.lavaTank); MultiFluidTank multitank = new MultiFluidTank(); SmelteryComponent smeltery = new SmelteryComponent(this, structure, multitank, 800); - + HashMap airUpdates = new HashMap(); int tick = 0; public MultiFluidTank getMultiTank () @@ -93,6 +93,9 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc } tick = 0; } + + if (airUpdates.size() > 0) + updateFluidBlocks(); } public void setUpdateFluids () @@ -282,7 +285,7 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc { //Calculate liquids in each block int size = structure.getAirLayerSize(); - HashMap blocks = new HashMap(); + //HashMap blocks = new HashMap(); for (FluidStack fluid : multitank.fluidlist) { @@ -299,22 +302,24 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc int height = 16 * (coord.y - baseY); int position = i % layerSize; - if (!blocks.containsKey(coord)) + if (!airUpdates.containsKey(coord)) { instance = new LiquidDataInstance(); - blocks.put(coord, instance); + airUpdates.put(coord, instance); } else { - instance = blocks.get(coord); + instance = airUpdates.get(coord); } - if (instance.openLayers() > 0) + if (instance.openLayers() > 0) //This is capable of sending negative liquid sizes to blocks without the stopgap check { if (position > data.blocksWithExtra) { //Calculate open layers int open = data.layers - height + 1; + if (open < 1) //Temporary stopgap check + continue; if (open > instance.openLayers()) open = instance.openLayers(); @@ -325,13 +330,15 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc //Subtract from total data.totalAmount -= newFluid.amount; - if (data.totalAmount < 0) + if (data.totalAmount <= 0) break; } else if (position == data.blocksWithExtra && data.leftovers > 0) { //Calculate open layers int open = data.layers - height + 1; + if (open < 1) //Temporary stopgap check + continue; boolean full = false; if (open > instance.openLayers()) { @@ -348,13 +355,15 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc //Subtract from total data.totalAmount -= newFluid.amount; - if (data.totalAmount < 0) + if (data.totalAmount <= 0) break; } else { //Calculate open layers int open = data.layers - height; + if (open < 1) //Temporary stopgap check + continue; if (open > instance.openLayers()) open = instance.openLayers(); @@ -365,7 +374,7 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc //Subtract from total data.totalAmount -= newFluid.amount; - if (data.totalAmount < 0) + if (data.totalAmount <= 0) break; } } @@ -373,8 +382,13 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc } //Distribute liquids to each block - Iterator iter = blocks.entrySet().iterator(); - while (iter.hasNext()) + } + + protected void updateFluidBlocks() + { + Iterator iter = airUpdates.entrySet().iterator(); + byte count = 0; + while (iter.hasNext() && count < 40) { Map.Entry pairs = (Map.Entry) iter.next(); CoordTuple coord = (CoordTuple) pairs.getKey(); @@ -383,10 +397,12 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc { ((TankAirLogic) te).overrideFluids(((LiquidDataInstance) pairs.getValue()).fluids); } + iter.remove(); + count++; } } - public void updateAir() + public void updateAir () { for (CoordTuple loc : structure.airCoords) worldObj.markBlockForUpdate(loc.x, loc.y, loc.z); diff --git a/src/tconstruct/client/TProxyClient.java b/src/tconstruct/client/TProxyClient.java index 9985b8d7..7a268e43 100644 --- a/src/tconstruct/client/TProxyClient.java +++ b/src/tconstruct/client/TProxyClient.java @@ -26,17 +26,20 @@ import net.minecraftforge.fluids.RenderBlockFluid; import org.lwjgl.opengl.GL11; import org.w3c.dom.Document; import tconstruct.TConstruct; +import tconstruct.blocks.SlimeExplosive; import tconstruct.blocks.logic.*; import tconstruct.client.armor.RenderArmorCast; import tconstruct.client.block.*; import tconstruct.client.entity.*; +import tconstruct.client.entity.item.ExplosiveRender; import tconstruct.client.entity.projectile.*; import tconstruct.client.gui.*; import tconstruct.client.pages.*; import tconstruct.client.tabs.*; import tconstruct.common.*; import tconstruct.entity.*; -import tconstruct.entity.item.EntityLandmineFirework; +import tconstruct.entity.item.*; +import tconstruct.entity.item.*; import tconstruct.entity.projectile.*; import tconstruct.inventory.ContainerLandmine; import tconstruct.library.TConstructRegistry; @@ -232,6 +235,7 @@ public class TProxyClient extends TProxyCommon RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRenderCustom()); RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowRenderCustom()); RenderingRegistry.registerEntityRenderingHandler(EntityLandmineFirework.class, new RenderSnowball(Item.firework)); + RenderingRegistry.registerEntityRenderingHandler(ExplosivePrimed.class, new ExplosiveRender()); // RenderingRegistry.registerEntityRenderingHandler(net.minecraft.entity.player.EntityPlayer.class, // new PlayerArmorRender()); // <-- Works, woo! diff --git a/src/tconstruct/client/block/TankAirRender.java b/src/tconstruct/client/block/TankAirRender.java index 4c9640e0..7a6c298c 100644 --- a/src/tconstruct/client/block/TankAirRender.java +++ b/src/tconstruct/client/block/TankAirRender.java @@ -46,6 +46,7 @@ public class TankAirRender implements ISimpleBlockRenderingHandler for (FluidStack fluidstack : logic.getFluids()) { Fluid fluid = fluidstack.getFluid(); + //System.out.println("Base: "+getBaseAmount(base)+", Height: "+getHeightAmount(base, fluidstack.amount)+", fluid amount: "+fluidstack.amount); renderer.setRenderBounds(0.0, getBaseAmount(base), 0.0, 1.0, getHeightAmount(base, fluidstack.amount), 1.0); if (fluid.canBePlacedInWorld()) BlockSkinRenderHelper.renderMetadataBlock(Block.blocksList[fluid.getBlockID()], 0, x, y, z, renderer, world); @@ -57,7 +58,7 @@ public class TankAirRender implements ISimpleBlockRenderingHandler } return true; } - + private double getBaseAmount (int base) { return base / capacity; diff --git a/src/tconstruct/client/entity/item/ExplosiveRender.java b/src/tconstruct/client/entity/item/ExplosiveRender.java new file mode 100644 index 00000000..3d41277c --- /dev/null +++ b/src/tconstruct/client/entity/item/ExplosiveRender.java @@ -0,0 +1,98 @@ +package tconstruct.client.entity.item; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import tconstruct.common.TContent; +import tconstruct.entity.item.ExplosivePrimed; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class ExplosiveRender extends Render +{ + private RenderBlocks blockRenderer = new RenderBlocks(); + + public ExplosiveRender() + { + this.shadowSize = 0.5F; + } + + public void renderPrimedTNT(ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float)par2, (float)par4, (float)par6); + float f2; + + if ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F) + { + f2 = 1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F; + + if (f2 < 0.0F) + { + f2 = 0.0F; + } + + if (f2 > 1.0F) + { + f2 = 1.0F; + } + + f2 *= f2; + f2 *= f2; + float f3 = 1.0F + f2 * 0.3F; + GL11.glScalef(f3, f3, f3); + } + + f2 = (1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F; + this.bindEntityTexture(par1EntityTNTPrimed); + this.blockRenderer.renderBlockAsItem(TContent.slimeExplosive, 0, par1EntityTNTPrimed.getBrightness(par9)); + + if (par1EntityTNTPrimed.fuse / 5 % 2 == 0) + { + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); + GL11.glColor4f(1.0F, 1.0F, 1.0F, f2); + this.blockRenderer.renderBlockAsItem(Block.tnt, 0, 1.0F); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_TEXTURE_2D); + } + + GL11.glPopMatrix(); + } + + protected ResourceLocation func_110808_a(ExplosivePrimed par1EntityTNTPrimed) + { + return TextureMap.locationBlocksTexture; + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity par1Entity) + { + return this.func_110808_a((ExplosivePrimed)par1Entity); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render 0.0F; f1 -= f2 * 0.75F) + { + int l = MathHelper.floor_double(d0); + int i1 = MathHelper.floor_double(d1); + int j1 = MathHelper.floor_double(d2); + int k1 = this.world.getBlockId(l, i1, j1); + + if (k1 > 0) + { + Block block = Block.blocksList[k1]; + float f3 = this.exploder != null ? this.exploder.getBlockExplosionResistance(this, this.world, l, i1, j1, block) : block.getExplosionResistance(this.exploder, world, + l, i1, j1, explosionX, explosionY, explosionZ); + f1 -= (f3 + 0.8F) * f2 * 0.25f; + } + + if (f1 > 0.0F && (this.exploder == null || this.exploder.shouldExplodeBlock(this, this.world, l, i1, j1, k1, f1))) + { + hashset.add(new ChunkPosition(l, i1, j1)); + } + + d0 += d3 * (double) f2; + d1 += d4 * (double) f2; + d2 += d5 * (double) f2; + } + } + } + } + } + + this.affectedBlockPositions.addAll(hashset); + this.explosionSize *= 2.0F; + i = MathHelper.floor_double(this.explosionX - (double) this.explosionSize - 1.0D); + j = MathHelper.floor_double(this.explosionX + (double) this.explosionSize + 1.0D); + k = MathHelper.floor_double(this.explosionY - (double) this.explosionSize - 1.0D); + int l1 = MathHelper.floor_double(this.explosionY + (double) this.explosionSize + 1.0D); + int i2 = MathHelper.floor_double(this.explosionZ - (double) this.explosionSize - 1.0D); + int j2 = MathHelper.floor_double(this.explosionZ + (double) this.explosionSize + 1.0D); + List list = this.world.getEntitiesWithinAABBExcludingEntity(this.exploder, AxisAlignedBB.getAABBPool().getAABB((double) i, (double) k, (double) i2, (double) j, (double) l1, (double) j2)); + Vec3 vec3 = this.world.getWorldVec3Pool().getVecFromPool(this.explosionX, this.explosionY, this.explosionZ); + + for (int k2 = 0; k2 < list.size(); ++k2) + { + Entity entity = (Entity) list.get(k2); + double d7 = entity.getDistance(this.explosionX, this.explosionY, this.explosionZ) / (double) this.explosionSize; + + if (d7 <= 1.0D) + { + d0 = entity.posX - this.explosionX; + d1 = entity.posY + (double) entity.getEyeHeight() - this.explosionY; + d2 = entity.posZ - this.explosionZ; + double d8 = (double) MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2); + + if (d8 != 0.0D) + { + d0 /= d8; + d1 /= d8; + d2 /= d8; + double d9 = (double) this.world.getBlockDensity(vec3, entity.boundingBox); + double d10 = (1.0D - d7) * d9; + if (!(entity instanceof EntityItem)) + entity.attackEntityFrom(DamageSource.setExplosionSource(this), (float) ((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.explosionSize + 1.0D))); + double d11 = EnchantmentProtection.func_92092_a(entity, d10); + entity.motionX += d0 * d11; + entity.motionY += d1 * d11; + entity.motionZ += d2 * d11; + + if (entity instanceof EntityPlayer) + { + this.field_77288_k.put((EntityPlayer) entity, this.world.getWorldVec3Pool().getVecFromPool(d0 * d10, d1 * d10, d2 * d10)); + } + } + } + } + + this.explosionSize = f; + } + + public void doExplosionB (boolean par1) + { + this.world.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.world.rand.nextFloat() - this.world.rand.nextFloat()) * 0.2F) * 0.7F); + + if (this.explosionSize >= 2.0F && this.isSmoking) + { + this.world.spawnParticle("hugeexplosion", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + else + { + this.world.spawnParticle("largeexplode", this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D); + } + + Iterator iterator; + ChunkPosition chunkposition; + int i; + int j; + int k; + int l; + + if (this.isSmoking) + { + iterator = this.affectedBlockPositions.iterator(); + + while (iterator.hasNext()) + { + chunkposition = (ChunkPosition) iterator.next(); + i = chunkposition.x; + j = chunkposition.y; + k = chunkposition.z; + l = this.world.getBlockId(i, j, k); + + if (par1) + { + double d0 = (double) ((float) i + this.world.rand.nextFloat()); + double d1 = (double) ((float) j + this.world.rand.nextFloat()); + double d2 = (double) ((float) k + this.world.rand.nextFloat()); + double d3 = d0 - this.explosionX; + double d4 = d1 - this.explosionY; + double d5 = d2 - this.explosionZ; + double d6 = (double) MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); + d3 /= d6; + d4 /= d6; + d5 /= d6; + double d7 = 0.5D / (d6 / (double) this.explosionSize + 0.1D); + d7 *= (double) (this.world.rand.nextFloat() * this.world.rand.nextFloat() + 0.3F); + d3 *= d7; + d4 *= d7; + d5 *= d7; + this.world.spawnParticle("explode", (d0 + this.explosionX * 1.0D) / 2.0D, (d1 + this.explosionY * 1.0D) / 2.0D, (d2 + this.explosionZ * 1.0D) / 2.0D, d3, d4, d5); + this.world.spawnParticle("smoke", d0, d1, d2, d3, d4, d5); + } + + if (l > 0) + { + Block block = Block.blocksList[l]; + + if (block.canDropFromExplosion(this)) + { + block.dropBlockAsItemWithChance(this.world, i, j, k, this.world.getBlockMetadata(i, j, k), 1.0F, 0); + } + + block.onBlockExploded(this.world, i, j, k, this); + } + } + } + + if (this.isFlaming) + { + iterator = this.affectedBlockPositions.iterator(); + + while (iterator.hasNext()) + { + chunkposition = (ChunkPosition) iterator.next(); + i = chunkposition.x; + j = chunkposition.y; + k = chunkposition.z; + l = this.world.getBlockId(i, j, k); + int i1 = this.world.getBlockId(i, j - 1, k); + + if (l == 0 && Block.opaqueCubeLookup[i1] && this.random.nextInt(3) == 0) + { + this.world.setBlock(i, j, k, Block.fire.blockID); + } + } + } + } +} diff --git a/src/tconstruct/util/config/PHConstruct.java b/src/tconstruct/util/config/PHConstruct.java index 696ddb76..435b3041 100644 --- a/src/tconstruct/util/config/PHConstruct.java +++ b/src/tconstruct/util/config/PHConstruct.java @@ -178,6 +178,7 @@ public class PHConstruct woolSlab1 = config.getBlock("Wool Slab 1", 3244).getInt(3244); woolSlab2 = config.getBlock("Wool Slab 2", 3245).getInt(3245); airTank = config.getBlock("Air Tank", 3246).getInt(3246); + slimeExplosive = config.getBlock("SDX", 3247).getInt(3247); castingChannel = config.getBlock("Casting Channel", 3249).getInt(3249); woodenRail = config.getBlock("Wooden Rail", 3250).getInt(3250); @@ -424,6 +425,7 @@ public class PHConstruct public static int barricadeSpruce; public static int barricadeBirch; public static int barricadeJungle; + public static int slimeExplosive; //InfiBlocks public static int speedBlock;