From 05b6d9b95a09b5ff8667666d69fcabedd400c08f Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 2 Jan 2022 18:33:40 +0100 Subject: [PATCH] detonator improvements, large pylon, more dynamite --- src/main/java/com/hbm/blocks/ModBlocks.java | 4 +- .../com/hbm/blocks/bomb/BlockChargeBase.java | 54 +++ .../hbm/blocks/bomb/BlockChargeDynamite.java | 11 + .../com/hbm/blocks/bomb/BlockCrashedBomb.java | 58 ++- .../java/com/hbm/blocks/bomb/BlockSemtex.java | 10 +- .../com/hbm/blocks/bomb/BombFlameWar.java | 37 +- .../java/com/hbm/blocks/bomb/BombFloat.java | 62 +-- .../java/com/hbm/blocks/bomb/BombMulti.java | 376 +++++++----------- .../com/hbm/blocks/bomb/BombRejuvinator.java | 99 ----- .../java/com/hbm/blocks/bomb/BombThermo.java | 74 ++-- .../com/hbm/blocks/bomb/CompactLauncher.java | 93 ++--- .../java/com/hbm/blocks/bomb/DetCord.java | 44 +- .../java/com/hbm/blocks/bomb/DetMiner.java | 43 +- .../java/com/hbm/blocks/bomb/Landmine.java | 71 ++-- .../java/com/hbm/blocks/bomb/LaunchPad.java | 29 +- .../java/com/hbm/blocks/bomb/LaunchTable.java | 146 ++++--- .../com/hbm/blocks/bomb/NukeBalefire.java | 10 +- .../java/com/hbm/blocks/bomb/NukeBoy.java | 73 ++-- .../java/com/hbm/blocks/bomb/NukeCustom.java | 41 +- .../java/com/hbm/blocks/bomb/NukeFleija.java | 207 +++++----- .../java/com/hbm/blocks/bomb/NukeGadget.java | 13 +- .../java/com/hbm/blocks/bomb/NukeMan.java | 186 ++++----- .../java/com/hbm/blocks/bomb/NukeMike.java | 78 ++-- src/main/java/com/hbm/blocks/bomb/NukeN2.java | 196 +++++---- .../java/com/hbm/blocks/bomb/NukeN45.java | 134 +++---- .../com/hbm/blocks/bomb/NukePrototype.java | 219 +++++----- .../com/hbm/blocks/bomb/NukeSolinium.java | 206 +++++----- .../java/com/hbm/blocks/bomb/NukeTsar.java | 235 +++++------ .../com/hbm/blocks/generic/WasteEarth.java | 2 +- .../com/hbm/blocks/machine/BlastDoor.java | 20 +- .../com/hbm/blocks/machine/BlockSeal.java | 231 +++++------ .../hbm/blocks/machine/DummyBlockBlast.java | 26 +- .../hbm/blocks/machine/DummyBlockVault.java | 118 +++--- .../com/hbm/blocks/machine/VaultDoor.java | 245 ++++-------- .../com/hbm/blocks/network/PylonLarge.java | 24 +- src/main/java/com/hbm/interfaces/IBomb.java | 38 +- .../java/com/hbm/inventory/SlotSmelting.java | 89 +++++ .../container/ContainerDiFurnace.java | 2 - .../container/ContainerElectricFurnace.java | 67 ++-- .../container/ContainerMachineArcFurnace.java | 68 ++-- .../com/hbm/items/tool/ItemDetonator.java | 105 ++--- .../java/com/hbm/items/tool/ItemWiring.java | 41 +- .../render/tileentity/RenderPylonBase.java | 60 ++- .../render/tileentity/RenderPylonLarge.java | 8 +- .../network/TileEntityPylonBase.java | 9 +- .../network/TileEntityPylonLarge.java | 20 +- src/main/java/com/hbm/util/ChatBuilder.java | 47 +++ src/main/resources/assets/hbm/lang/de_DE.lang | 7 + src/main/resources/assets/hbm/lang/en_US.lang | 7 + .../hbm/models/weapons/charge_dynamite.obj | 181 +++++++++ .../hbm/textures/blocks/red_pylon_large.png | Bin 0 -> 202 bytes 51 files changed, 2142 insertions(+), 2082 deletions(-) create mode 100644 src/main/java/com/hbm/blocks/bomb/BlockChargeBase.java create mode 100644 src/main/java/com/hbm/blocks/bomb/BlockChargeDynamite.java delete mode 100644 src/main/java/com/hbm/blocks/bomb/BombRejuvinator.java create mode 100644 src/main/java/com/hbm/inventory/SlotSmelting.java create mode 100644 src/main/java/com/hbm/util/ChatBuilder.java create mode 100644 src/main/resources/assets/hbm/models/weapons/charge_dynamite.obj create mode 100644 src/main/resources/assets/hbm/textures/blocks/red_pylon_large.png diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 1d120b646..503a66ef7 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -484,6 +484,8 @@ public class ModBlocks { public static Block crashed_balefire; public static Block rejuvinator; public static Block fireworks; + + public static Block charge_dynamite; public static Block mine_ap; public static Block mine_he; @@ -1688,8 +1690,8 @@ public class ModBlocks { lox_barrel = new RedBarrel(Material.iron).setBlockName("lox_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_lox"); taint_barrel = new RedBarrel(Material.iron).setBlockName("taint_barrel").setCreativeTab(MainRegistry.nukeTab).setHardness(0.5F).setResistance(2.5F).setBlockTextureName(RefStrings.MODID + ":barrel_taint"); crashed_balefire = new BlockCrashedBomb(Material.iron).setBlockName("crashed_bomb").setCreativeTab(MainRegistry.nukeTab).setBlockUnbreakable().setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":crashed_balefire"); - rejuvinator = new BombRejuvinator(Material.iron).setBlockName("rejuvinator").setCreativeTab(MainRegistry.nukeTab).setResistance(6000.0F).setBlockTextureName(RefStrings.MODID + ":inserter_side"); fireworks = new BlockFireworks(Material.iron).setBlockName("fireworks").setCreativeTab(MainRegistry.nukeTab).setResistance(5.0F); + charge_dynamite = new BlockChargeDynamite().setBlockName("charge_dynamite").setCreativeTab(MainRegistry.nukeTab).setResistance(1.0F); mine_ap = new Landmine(Material.iron).setBlockName("mine_ap").setCreativeTab(MainRegistry.nukeTab).setHardness(1.0F).setBlockTextureName(RefStrings.MODID + ":mine_ap"); mine_he = new Landmine(Material.iron).setBlockName("mine_he").setCreativeTab(MainRegistry.nukeTab).setHardness(1.0F).setBlockTextureName(RefStrings.MODID + ":mine_he"); mine_shrap = new Landmine(Material.iron).setBlockName("mine_shrap").setCreativeTab(MainRegistry.nukeTab).setHardness(1.0F).setBlockTextureName(RefStrings.MODID + ":mine_shrap"); diff --git a/src/main/java/com/hbm/blocks/bomb/BlockChargeBase.java b/src/main/java/com/hbm/blocks/bomb/BlockChargeBase.java new file mode 100644 index 000000000..51cb28f47 --- /dev/null +++ b/src/main/java/com/hbm/blocks/bomb/BlockChargeBase.java @@ -0,0 +1,54 @@ +package com.hbm.blocks.bomb; + +import static net.minecraftforge.common.util.ForgeDirection.DOWN; +import static net.minecraftforge.common.util.ForgeDirection.EAST; +import static net.minecraftforge.common.util.ForgeDirection.NORTH; +import static net.minecraftforge.common.util.ForgeDirection.SOUTH; +import static net.minecraftforge.common.util.ForgeDirection.UP; +import static net.minecraftforge.common.util.ForgeDirection.WEST; + +import com.hbm.blocks.BlockBase; +import com.hbm.interfaces.IBomb; + +import net.minecraft.block.material.Material; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public abstract class BlockChargeBase extends BlockBase implements IBomb { + + public BlockChargeBase() { + super(Material.tnt); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public int onBlockPlaced(World world, int x, int y, int z, int side, float fX, float fY, float fZ, int meta) { + return side; + } + + @Override + public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) { + ForgeDirection dir = ForgeDirection.getOrientation(side); + return (dir == DOWN && world.isSideSolid(x, y + 1, z, DOWN)) || + (dir == UP && world.isSideSolid(x, y - 1, z, UP)) || + (dir == NORTH && world.isSideSolid(x, y, z + 1, NORTH)) || + (dir == SOUTH && world.isSideSolid(x, y, z - 1, SOUTH)) || + (dir == WEST && world.isSideSolid(x + 1, y, z, WEST)) || + (dir == EAST && world.isSideSolid(x - 1, y, z, EAST)); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + return null; + } +} diff --git a/src/main/java/com/hbm/blocks/bomb/BlockChargeDynamite.java b/src/main/java/com/hbm/blocks/bomb/BlockChargeDynamite.java new file mode 100644 index 000000000..dfa2b9ce9 --- /dev/null +++ b/src/main/java/com/hbm/blocks/bomb/BlockChargeDynamite.java @@ -0,0 +1,11 @@ +package com.hbm.blocks.bomb; + +import net.minecraft.world.World; + +public class BlockChargeDynamite extends BlockChargeBase { + + @Override + public BombReturnCode explode(World world, int x, int y, int z) { + return null; + } +} diff --git a/src/main/java/com/hbm/blocks/bomb/BlockCrashedBomb.java b/src/main/java/com/hbm/blocks/bomb/BlockCrashedBomb.java index c03446c9e..730cac10b 100644 --- a/src/main/java/com/hbm/blocks/bomb/BlockCrashedBomb.java +++ b/src/main/java/com/hbm/blocks/bomb/BlockCrashedBomb.java @@ -7,7 +7,6 @@ import com.hbm.config.BombConfig; import com.hbm.entity.logic.EntityBalefire; import com.hbm.interfaces.IBomb; import com.hbm.items.ModItems; -import com.hbm.main.MainRegistry; import com.hbm.packet.AuxParticlePacketNT; import com.hbm.packet.PacketDispatcher; import com.hbm.tileentity.bomb.TileEntityCrashedBomb; @@ -35,56 +34,51 @@ public class BlockCrashedBomb extends BlockContainer implements IBomb { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityCrashedBomb(); } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.crashed_balefire); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.crashed_balefire); + } + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) { - + if(world.isRemote) return true; - - if (player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.defuser) { + + if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.defuser) { world.func_147480_a(x, y, z, false); @@ -97,25 +91,27 @@ public class BlockCrashedBomb extends BlockContainer implements IBomb { return false; } - + @Override - public void explode(World world, int x, int y, int z) { - - if (!world.isRemote) { - - world.setBlockToAir(x, y, z); + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + + world.setBlockToAir(x, y, z); EntityBalefire bf = new EntityBalefire(world).mute(); bf.posX = x; bf.posY = y; bf.posZ = z; bf.destructionRange = (int) (BombConfig.fatmanRadius * 1.25); world.spawnEntityInWorld(bf); - + NBTTagCompound data = new NBTTagCompound(); data.setString("type", "muke"); data.setBoolean("balefire", true); PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + 0.5, y + 0.5, z + 0.5), new TargetPoint(world.provider.dimensionId, x + 0.5, y + 0.5, z + 0.5, 250)); world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "hbm:weapon.mukeExplosion", 15.0F, 1.0F); - } + } + + return BombReturnCode.DETONATED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/BlockSemtex.java b/src/main/java/com/hbm/blocks/bomb/BlockSemtex.java index 8bfd1f55c..ee5dd37d0 100644 --- a/src/main/java/com/hbm/blocks/bomb/BlockSemtex.java +++ b/src/main/java/com/hbm/blocks/bomb/BlockSemtex.java @@ -1,9 +1,5 @@ package com.hbm.blocks.bomb; -import com.hbm.blocks.ModBlocks; -import com.hbm.config.BombConfig; -import com.hbm.entity.effect.EntityNukeCloudSmall; -import com.hbm.entity.logic.EntityNukeExplosionMK4; import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNT; import com.hbm.interfaces.IBomb; @@ -15,7 +11,6 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; @@ -86,10 +81,13 @@ public class BlockSemtex extends Block implements IBomb { } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { + if(!world.isRemote) { new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 50).overrideResolution(64).explode(); ExplosionLarge.spawnParticles(world, x, y, z, ExplosionLarge.cloudFunction(15)); } + + return BombReturnCode.DETONATED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/BombFlameWar.java b/src/main/java/com/hbm/blocks/bomb/BombFlameWar.java index a37c346f4..6cc36770b 100644 --- a/src/main/java/com/hbm/blocks/bomb/BombFlameWar.java +++ b/src/main/java/com/hbm/blocks/bomb/BombFlameWar.java @@ -8,27 +8,30 @@ import net.minecraft.block.material.Material; import net.minecraft.world.World; public class BombFlameWar extends Block implements IBomb { - - public BombFlameWar(Material p_i45394_1_) { + + public BombFlameWar(Material p_i45394_1_) { super(p_i45394_1_); } @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - ExplosionChaos.explode(p_149695_1_, x, y, z, 15); - ExplosionChaos.spawnExplosion(p_149695_1_, x, y, z, 75); - ExplosionChaos.flameDeath(p_149695_1_, x, y, z, 100); - } - } - - @Override - public void explode(World world, int x, int y, int z) { - ExplosionChaos.explode(world, x, y, z, 15); - ExplosionChaos.spawnExplosion(world, x, y, z, 75); - ExplosionChaos.flameDeath(world, x, y, z, 100); + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + + if(world.isBlockIndirectlyGettingPowered(x, y, z)) { + ExplosionChaos.explode(world, x, y, z, 15); + ExplosionChaos.spawnExplosion(world, x, y, z, 75); + ExplosionChaos.flameDeath(world, x, y, z, 100); + } } + @Override + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + ExplosionChaos.explode(world, x, y, z, 15); + ExplosionChaos.spawnExplosion(world, x, y, z, 75); + ExplosionChaos.flameDeath(world, x, y, z, 100); + } + + return BombReturnCode.DETONATED; + } } diff --git a/src/main/java/com/hbm/blocks/bomb/BombFloat.java b/src/main/java/com/hbm/blocks/bomb/BombFloat.java index 3a4e54435..5f5c1c71b 100644 --- a/src/main/java/com/hbm/blocks/bomb/BombFloat.java +++ b/src/main/java/com/hbm/blocks/bomb/BombFloat.java @@ -17,16 +17,16 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; public class BombFloat extends Block implements IBomb { - - public World worldObj; - + + public World worldObj; + @SideOnly(Side.CLIENT) private IIcon iconTop; public BombFloat(Material p_i45394_1_) { super(p_i45394_1_); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -47,34 +47,34 @@ public class BombFloat extends Block implements IBomb { } @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - this.worldObj = p_149695_1_; - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - explode(p_149695_1_, x, y, z); - } - } - - @Override - public void explode(World world, int x, int y, int z) { - world.playSoundEffect(x, y, z, "hbm:weapon.sparkShoot", 5.0f, world.rand.nextFloat() * 0.2F + 0.9F); - - if(!world.isRemote) { - world.setBlock(x, y, z, Blocks.air); - if(this == ModBlocks.float_bomb) { - ExplosionChaos.floater(world, x, y, z, 15, 50); - ExplosionChaos.move(world, x, y, z, 15, 0, 50, 0); - } - if(this == ModBlocks.emp_bomb) { - ExplosionNukeGeneric.empBlast(world, x, y, z, 50); - EntityEMPBlast wave = new EntityEMPBlast(world, 50); - wave.posX = x + 0.5; - wave.posY = y + 0.5; - wave.posZ = z + 0.5; - world.spawnEntityInWorld(wave); - } + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + this.worldObj = p_149695_1_; + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) { + explode(p_149695_1_, x, y, z); } } + @Override + public BombReturnCode explode(World world, int x, int y, int z) { + world.playSoundEffect(x, y, z, "hbm:weapon.sparkShoot", 5.0f, world.rand.nextFloat() * 0.2F + 0.9F); + + if(!world.isRemote) { + world.setBlock(x, y, z, Blocks.air); + if(this == ModBlocks.float_bomb) { + ExplosionChaos.floater(world, x, y, z, 15, 50); + ExplosionChaos.move(world, x, y, z, 15, 0, 50, 0); + } + if(this == ModBlocks.emp_bomb) { + ExplosionNukeGeneric.empBlast(world, x, y, z, 50); + EntityEMPBlast wave = new EntityEMPBlast(world, 50); + wave.posX = x + 0.5; + wave.posY = y + 0.5; + wave.posZ = z + 0.5; + world.spawnEntityInWorld(wave); + } + } + + return BombReturnCode.DETONATED; + } + } diff --git a/src/main/java/com/hbm/blocks/bomb/BombMulti.java b/src/main/java/com/hbm/blocks/bomb/BombMulti.java index 568d2647b..5323548a1 100644 --- a/src/main/java/com/hbm/blocks/bomb/BombMulti.java +++ b/src/main/java/com/hbm/blocks/bomb/BombMulti.java @@ -1,7 +1,5 @@ package com.hbm.blocks.bomb; -import java.util.HashMap; -import java.util.Map; import java.util.Random; import net.minecraft.block.Block; @@ -31,18 +29,10 @@ import cpw.mods.fml.common.network.internal.FMLNetworkHandler; public class BombMulti extends BlockContainer implements IBomb { - public TileEntityBombMulti tetn = new TileEntityBombMulti(); - public final float explosionBaseValue = 8.0F; - public float explosionValue = 0.0F; - public int clusterCount = 0; - public int fireRadius = 0; - public int poisonRadius = 0; - public int gasCloud = 0; - private final Random field_149933_a = new Random(); + private final Random field_149933_a = new Random(); private static boolean keepInventory = false; - private Map field_77288_k = new HashMap(); public BombMulti(Material p_i45386_1_) { super(p_i45386_1_); @@ -52,75 +42,63 @@ public class BombMulti extends BlockContainer implements IBomb { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityBombMulti(); } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.bomb_multi); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.bomb_multi); + } + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - TileEntityBombMulti tileentityfurnace = (TileEntityBombMulti)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityBombMulti tileentityfurnace = (TileEntityBombMulti) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityBombMulti entity = (TileEntityBombMulti) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_bomb_multi, world, x, y, z); } return true; @@ -128,206 +106,138 @@ public class BombMulti extends BlockContainer implements IBomb { return false; } } - - @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - TileEntityBombMulti entity = (TileEntityBombMulti) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - if(/*entity.getExplosionType() != 0*/entity.isLoaded()) - { - this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); - igniteTestBomb(p_149695_1_, x, y, z); - } - } - } - - public boolean igniteTestBomb(World world, int x, int y, int z) - { - TileEntityBombMulti entity = (TileEntityBombMulti) world.getTileEntity(x, y, z); - if (!world.isRemote) - { - //world.spawnParticle("hugeexplosion", x, y, z, 0, 0, 0); - //world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); - - /*switch(entity.getExplosionType()) - { - case 1: - entity.clearSlots(); - world.setBlockToAir(x, y, z); - world.createExplosion(null, x , y , z , 18.0F, true); - break; - case 2: - entity.clearSlots(); - world.setBlockToAir(x, y, z); - world.createExplosion(null, x , y , z , 34.0F, true); - break; - case 3: - entity.clearSlots(); - world.setBlockToAir(x, y, z); - world.createExplosion(null, x , y , z , 8.0F, true); - ExplosionChaos.cluster(world, x, y, z, 100, 1); - break; - case 4: - entity.clearSlots(); - world.setBlockToAir(x, y, z); - world.createExplosion(null, x , y , z , 3.0F, true); - ExplosionChaos.burn(world, x, y, z, 20); - break; - case 5: - entity.clearSlots(); - world.setBlockToAir(x, y, z); - world.createExplosion(null, x , y , z , 3.0F, true); - ExplosionNukeGeneric.waste(world, x, y, z, 30); - break; - case 6: - entity.clearSlots(); - world.setBlockToAir(x, y, z); - world.createExplosion(null, x , y , z , 3.0F, true); - ExplosionChaos.poison(world, x, y, z, 25); - break; - }*/ - if(entity.isLoaded()) - { - this.explosionValue = this.explosionBaseValue; - switch(entity.return2type()) - { - case 1: - this.explosionValue += 1.0F; - break; - case 2: - this.explosionValue += 4.0F; - break; - case 3: - this.clusterCount += 50; - break; - case 4: - this.fireRadius += 10; - break; - case 5: - this.poisonRadius += 15; - break; - case 6: - this.gasCloud += 50; - } - switch(entity.return5type()) - { - case 1: - this.explosionValue += 1.0F; - break; - case 2: - this.explosionValue += 4.0F; - break; - case 3: - this.clusterCount += 50; - break; - case 4: - this.fireRadius += 10; - break; - case 5: - this.poisonRadius += 15; - break; - case 6: - this.gasCloud += 50; - } - entity.clearSlots(); - world.setBlockToAir(x, y, z); - //world.createExplosion(null, x , y , z , this.explosionValue, true); - ExplosionLarge.explode(world, x, y, z, explosionValue, true, true, true); - this.explosionValue = 0; - - if(this.clusterCount > 0) - { - ExplosionChaos.cluster(world, x, y, z, this.clusterCount, 1); - } - - if(this.fireRadius > 0) - { - ExplosionChaos.burn(world, x, y, z, this.fireRadius); - } - - if(this.poisonRadius > 0) - { - ExplosionNukeGeneric.wasteNoSchrab(world, x, y, z, this.poisonRadius); - } - - if(this.gasCloud > 0) - { - ExplosionChaos.spawnChlorine(world, x, y, z, this.gasCloud, this.gasCloud / 50, 0); - } - - this.clusterCount = 0; - this.fireRadius = 0; - this.poisonRadius = 0; - this.gasCloud = 0; - - - } - } - return false; - } - @Override - public int getRenderType(){ + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + TileEntityBombMulti entity = (TileEntityBombMulti) p_149695_1_.getTileEntity(x, y, z); + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) { + if(/* entity.getExplosionType() != 0 */entity.isLoaded()) { + this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); + igniteTestBomb(p_149695_1_, x, y, z); + } + } + } + + public BombReturnCode igniteTestBomb(World world, int x, int y, int z) { + TileEntityBombMulti entity = (TileEntityBombMulti) world.getTileEntity(x, y, z); + if(!world.isRemote) { + + if(entity.isLoaded()) { + + float explosionValue = 0.0F; + int clusterCount = 0; + int fireRadius = 0; + int poisonRadius = 0; + int gasCloud = 0; + + explosionValue = this.explosionBaseValue; + + switch(entity.return2type()) { + case 1: explosionValue += 1.0F; break; + case 2: explosionValue += 4.0F; break; + case 3: clusterCount += 50; break; + case 4: fireRadius += 10; break; + case 5: poisonRadius += 15; break; + case 6: gasCloud += 50; break; + } + switch(entity.return5type()) { + case 1: explosionValue += 1.0F; break; + case 2: explosionValue += 4.0F; break; + case 3: clusterCount += 50; break; + case 4: fireRadius += 10; break; + case 5: poisonRadius += 15; break; + case 6: gasCloud += 50; break; + } + + entity.clearSlots(); + world.setBlockToAir(x, y, z); + // world.createExplosion(null, x , y , z , this.explosionValue, + // true); + ExplosionLarge.explode(world, x, y, z, explosionValue, true, true, true); + explosionValue = 0; + + if(clusterCount > 0) { + ExplosionChaos.cluster(world, x, y, z, clusterCount, 1); + } + + if(fireRadius > 0) { + ExplosionChaos.burn(world, x, y, z, fireRadius); + } + + if(poisonRadius > 0) { + ExplosionNukeGeneric.wasteNoSchrab(world, x, y, z, poisonRadius); + } + + if(gasCloud > 0) { + ExplosionChaos.spawnChlorine(world, x, y, z, gasCloud, gasCloud / 50, 0); + } + + return BombReturnCode.DETONATED; + } + } + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + @Override + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } - + @Override - public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) - { - float f = 0.0625F; - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8*f, 1.0F); - } - + public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { + float f = 0.0625F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8 * f, 1.0F); + } + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - float f = 0.0625F; - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8*f, 1.0F); + float f = 0.0625F; + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 8 * f, 1.0F); return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } @Override - public void explode(World world, int x, int y, int z) { - TileEntityBombMulti entity = (TileEntityBombMulti) world.getTileEntity(x, y, z); - if(/*entity.getExplosionType() != 0*/entity.isLoaded()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - igniteTestBomb(world, x, y, z); - } + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityBombMulti entity = (TileEntityBombMulti) world.getTileEntity(x, y, z); + + if(entity.isLoaded()) { + return igniteTestBomb(world, x, y, z); + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + return BombReturnCode.UNDEFINED; } } \ No newline at end of file diff --git a/src/main/java/com/hbm/blocks/bomb/BombRejuvinator.java b/src/main/java/com/hbm/blocks/bomb/BombRejuvinator.java deleted file mode 100644 index 8be767d15..000000000 --- a/src/main/java/com/hbm/blocks/bomb/BombRejuvinator.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.hbm.blocks.bomb; - -import java.util.Random; - -import com.hbm.interfaces.IBomb; -import com.hbm.lib.RefStrings; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.init.Blocks; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderServer; - -public class BombRejuvinator extends Block implements IBomb { - - private final Random field_149933_a = new Random(); - private Random rand; - private static boolean keepInventory; - - @SideOnly(Side.CLIENT) - private IIcon iconTop; - - public BombRejuvinator(Material p_i45394_1_) { - super(p_i45394_1_); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - - this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":inserter_top"); - this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":inserter_side"); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int metadata) { - return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon); - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { - if (world.isBlockIndirectlyGettingPowered(x, y, z)) { - explode(world, x, y, z); - } - } - - @Override - public void explode(World worldObj, int x1, int y1, int z1) { - worldObj.setBlock(x1, y1, z1, Blocks.air); - if (!worldObj.isRemote) { - try { - Chunk oldChunk = worldObj.getChunkFromBlockCoords(x1, z1); - - if (worldObj instanceof WorldServer) { - WorldServer worldServer = (WorldServer) worldObj; - ChunkProviderServer chunkProviderServer = worldServer.theChunkProviderServer; - IChunkProvider chunkProviderGenerate = chunkProviderServer.currentChunkProvider; - - Chunk newChunk = chunkProviderGenerate.provideChunk(oldChunk.xPosition, oldChunk.zPosition); - - for (int x = 0; x < 16; x++) { - for (int z = 0; z < 16; z++) { - for (int y = 0; y < worldObj.getHeight(); y++) { - Block block = newChunk.getBlock(x, y, z); - int metadata = newChunk.getBlockMetadata(x, y, z); - - worldServer.setBlock(x + oldChunk.xPosition * 16, y, z + oldChunk.zPosition * 16, block, - metadata, 2); - - TileEntity tileEntity = newChunk.getTileEntityUnsafe(x, y, z); - - if (tileEntity != null) { - worldServer.setTileEntity(x + oldChunk.xPosition * 16, y, - z + oldChunk.zPosition * 16, tileEntity); - } - } - } - } - - oldChunk.isTerrainPopulated = false; - chunkProviderGenerate.populate(chunkProviderGenerate, oldChunk.xPosition, oldChunk.zPosition); - } - } catch (Exception e) { - System.out.println("Rejuvenation Failed!"); - e.printStackTrace(); - } - } - } - -} diff --git a/src/main/java/com/hbm/blocks/bomb/BombThermo.java b/src/main/java/com/hbm/blocks/bomb/BombThermo.java index 4f217f4df..d68c8a6a7 100644 --- a/src/main/java/com/hbm/blocks/bomb/BombThermo.java +++ b/src/main/java/com/hbm/blocks/bomb/BombThermo.java @@ -19,15 +19,13 @@ import net.minecraft.world.World; public class BombThermo extends Block implements IBomb { - private World worldObj; - @SideOnly(Side.CLIENT) private IIcon iconTop; public BombThermo(Material p_i45394_1_) { super(p_i45394_1_); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { @@ -36,15 +34,13 @@ public class BombThermo extends Block implements IBomb { } @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - if(this == ModBlocks.therm_endo) - { + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + if(this == ModBlocks.therm_endo) { return Item.getItemFromBlock(ModBlocks.therm_endo); } - + return Item.getItemFromBlock(ModBlocks.therm_exo); - } + } @Override @SideOnly(Side.CLIENT) @@ -53,43 +49,37 @@ public class BombThermo extends Block implements IBomb { } @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - this.worldObj = p_149695_1_; - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - p_149695_1_.setBlock(x, y, z, Blocks.air); - if(this == ModBlocks.therm_endo) - { - ExplosionThermo.freeze(p_149695_1_, x, y, z, 15); - ExplosionThermo.freezer(p_149695_1_, x, y, z, 20); - } + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) { + p_149695_1_.setBlock(x, y, z, Blocks.air); + if(this == ModBlocks.therm_endo) { + ExplosionThermo.freeze(p_149695_1_, x, y, z, 15); + ExplosionThermo.freezer(p_149695_1_, x, y, z, 20); + } - if(this == ModBlocks.therm_exo) - { - ExplosionThermo.scorch(p_149695_1_, x, y, z, 15); - ExplosionThermo.setEntitiesOnFire(p_149695_1_, x, y, z, 20); - } - - p_149695_1_.createExplosion(null, x, y, z, 5.0F, true); - } - } + if(this == ModBlocks.therm_exo) { + ExplosionThermo.scorch(p_149695_1_, x, y, z, 15); + ExplosionThermo.setEntitiesOnFire(p_149695_1_, x, y, z, 20); + } + + p_149695_1_.createExplosion(null, x, y, z, 5.0F, true); + } + } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { world.setBlock(x, y, z, Blocks.air); - if(this == ModBlocks.therm_endo) - { - ExplosionThermo.freeze(world, x, y, z, 15); - ExplosionThermo.freezer(world, x, y, z, 20); - } + if(this == ModBlocks.therm_endo) { + ExplosionThermo.freeze(world, x, y, z, 15); + ExplosionThermo.freezer(world, x, y, z, 20); + } - if(this == ModBlocks.therm_exo) - { - ExplosionThermo.scorch(world, x, y, z, 15); - ExplosionThermo.setEntitiesOnFire(world, x, y, z, 20); - } - - world.createExplosion(null, x, y, z, 5.0F, true); + if(this == ModBlocks.therm_exo) { + ExplosionThermo.scorch(world, x, y, z, 15); + ExplosionThermo.setEntitiesOnFire(world, x, y, z, 20); + } + + world.createExplosion(null, x, y, z, 5.0F, true); + return BombReturnCode.DETONATED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/CompactLauncher.java b/src/main/java/com/hbm/blocks/bomb/CompactLauncher.java index d0417a039..7b6774682 100644 --- a/src/main/java/com/hbm/blocks/bomb/CompactLauncher.java +++ b/src/main/java/com/hbm/blocks/bomb/CompactLauncher.java @@ -55,17 +55,14 @@ public class CompactLauncher extends BlockContainer implements IMultiblock, IBom public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(ModBlocks.struct_launcher_core); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityCompactLauncher entity = (TileEntityCompactLauncher) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_compact_launcher, world, x, y, z); } return true; @@ -73,18 +70,11 @@ public class CompactLauncher extends BlockContainer implements IMultiblock, IBom return false; } } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { - - if(!(world.getBlock(x + 1, y, z + 1).getMaterial().isReplaceable() && - world.getBlock(x + 1, y, z).getMaterial().isReplaceable() && - world.getBlock(x + 1, y, z - 1).getMaterial().isReplaceable() && - world.getBlock(x, y, z - 1).getMaterial().isReplaceable() && - world.getBlock(x - 1, y, z - 1).getMaterial().isReplaceable() && - world.getBlock(x - 1, y, z).getMaterial().isReplaceable() && - world.getBlock(x - 1, y, z + 1).getMaterial().isReplaceable() && - world.getBlock(x, y, z + 1).getMaterial().isReplaceable())) { + + if(!(world.getBlock(x + 1, y, z + 1).getMaterial().isReplaceable() && world.getBlock(x + 1, y, z).getMaterial().isReplaceable() && world.getBlock(x + 1, y, z - 1).getMaterial().isReplaceable() && world.getBlock(x, y, z - 1).getMaterial().isReplaceable() && world.getBlock(x - 1, y, z - 1).getMaterial().isReplaceable() && world.getBlock(x - 1, y, z).getMaterial().isReplaceable() && world.getBlock(x - 1, y, z + 1).getMaterial().isReplaceable() && world.getBlock(x, y, z + 1).getMaterial().isReplaceable())) { world.func_147480_a(x, y, z, true); return; } @@ -97,77 +87,76 @@ public class CompactLauncher extends BlockContainer implements IMultiblock, IBom placeDummy(world, x - 1, y, z, x, y, z, ModBlocks.dummy_plate_compact_launcher); placeDummy(world, x - 1, y, z + 1, x, y, z, ModBlocks.dummy_port_compact_launcher); placeDummy(world, x, y, z + 1, x, y, z, ModBlocks.dummy_plate_compact_launcher); - + super.onBlockPlacedBy(world, x, y, z, player, itemStack); - + } - + private void placeDummy(World world, int x, int y, int z, int xCoord, int yCoord, int zCoord, Block block) { - + world.setBlock(x, y, z, block); - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te; + TileEntityDummy dummy = (TileEntityDummy) te; dummy.targetX = xCoord; dummy.targetY = yCoord; dummy.targetZ = zCoord; } } - + @Override - public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) - { - this.setBlockBounds(0, 1, 0, 1, 1, 1); - } - + public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { + this.setBlockBounds(0, 1, 0, 1, 1, 1); + } + @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { - this.setBlockBounds(0, 1, 0, 1, 1, 1); + this.setBlockBounds(0, 1, 0, 1, 1, 1); return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { TileEntityCompactLauncher entity = (TileEntityCompactLauncher) world.getTileEntity(x, y, z); - - if(entity.canLaunch()) + + if(entity.canLaunch()) { entity.launch(); + return BombReturnCode.LAUNCHED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; } - private final Random field_149933_a = new Random(); - - @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, - int p_149749_6_) { - ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, - p_149749_4_); + private final Random field_149933_a = new Random(); - if (tileentityfurnace != null) { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + @Override + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) { + if(itemstack != null) { float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) { + while(itemstack.stackSize > 0) { int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) { + if(j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, - p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) { - entityitem.getEntityItem() - .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } float f3 = 0.05F; @@ -181,8 +170,6 @@ public class CompactLauncher extends BlockContainer implements IMultiblock, IBom p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); } - } diff --git a/src/main/java/com/hbm/blocks/bomb/DetCord.java b/src/main/java/com/hbm/blocks/bomb/DetCord.java index a9d99342c..152e55d33 100644 --- a/src/main/java/com/hbm/blocks/bomb/DetCord.java +++ b/src/main/java/com/hbm/blocks/bomb/DetCord.java @@ -1,7 +1,5 @@ package com.hbm.blocks.bomb; -import java.util.Random; - import com.hbm.blocks.ModBlocks; import com.hbm.config.BombConfig; import com.hbm.entity.effect.EntityNukeCloudSmall; @@ -17,7 +15,6 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; -import net.minecraft.item.Item; import net.minecraft.util.IIcon; import net.minecraft.world.Explosion; import net.minecraft.world.World; @@ -34,47 +31,38 @@ public class DetCord extends Block implements IBomb { @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { - + super.registerBlockIcons(iconRegister); - + this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":det_nuke_top"); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { - + if(this != ModBlocks.det_nuke) return this.blockIcon; - + return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : this.blockIcon); } - @Override - public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) - { - this.explode(world, x, y, z); - } + @Override + public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) { + this.explode(world, x, y, z); + } @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) - { - if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - this.explode(world, x, y, z); - } - } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return null; - } + public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { + if(world.isBlockIndirectlyGettingPowered(x, y, z)) { + this.explode(world, x, y, z); + } + } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { + if(!world.isRemote) { - world.setBlock(x, y, z, Blocks.air); if(this == ModBlocks.det_cord) { world.createExplosion(null, x + 0.5, y + 0.5, z + 0.5, 1.5F, true); @@ -93,6 +81,8 @@ public class DetCord extends Block implements IBomb { world.spawnEntityInWorld(entity2); } } + + return BombReturnCode.DETONATED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/DetMiner.java b/src/main/java/com/hbm/blocks/bomb/DetMiner.java index 304c70041..4bc5e01eb 100644 --- a/src/main/java/com/hbm/blocks/bomb/DetMiner.java +++ b/src/main/java/com/hbm/blocks/bomb/DetMiner.java @@ -20,40 +20,39 @@ public class DetMiner extends BlockPillar implements IBomb { super(mat, top); } - @Override + @Override public Item getItemDropped(int i, Random rand, int j) { - return null; - } + return null; + } @Override - public void explode(World world, int x, int y, int z) { - + public BombReturnCode explode(World world, int x, int y, int z) { + if(!world.isRemote) { - + world.func_147480_a(x, y, z, false); ExplosionNT explosion = new ExplosionNT(world, null, x + 0.5, y + 0.5, z + 0.5, 4); explosion.atttributes.add(ExAttrib.ALLDROP); explosion.atttributes.add(ExAttrib.NOHURT); explosion.doExplosionA(); explosion.doExplosionB(false); - + ExplosionLarge.spawnParticles(world, x + 0.5, y + 0.5, z + 0.5, 30); } + + return BombReturnCode.DETONATED; + } + + @Override + public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) { + this.explode(world, x, y, z); + } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { + if(world.isBlockIndirectlyGettingPowered(x, y, z)) { + this.explode(world, x, y, z); + } } - @Override - public void onBlockDestroyedByExplosion(World world, int x, int y, int z, Explosion p_149723_5_) - { - this.explode(world, x, y, z); - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) - { - if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - this.explode(world, x, y, z); - } - } - } diff --git a/src/main/java/com/hbm/blocks/bomb/Landmine.java b/src/main/java/com/hbm/blocks/bomb/Landmine.java index 5809cc65d..804be5825 100644 --- a/src/main/java/com/hbm/blocks/bomb/Landmine.java +++ b/src/main/java/com/hbm/blocks/bomb/Landmine.java @@ -57,73 +57,65 @@ public class Landmine extends BlockContainer implements IBomb { } @Override - public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, - int p_149719_4_) { + public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { float f = 0.0625F; - if (this == ModBlocks.mine_ap) + if(this == ModBlocks.mine_ap) this.setBlockBounds(6 * f, 0.0F, 6 * f, 10 * f, 2 * f, 10 * f); - if (this == ModBlocks.mine_he) + if(this == ModBlocks.mine_he) this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f); - if (this == ModBlocks.mine_shrap) + if(this == ModBlocks.mine_shrap) this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f); - if (this == ModBlocks.mine_fat) + if(this == ModBlocks.mine_fat) this.setBlockBounds(5 * f, 0.0F, 4 * f, 11 * f, 6 * f, 12 * f); } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { float f = 0.0625F; - if (this == ModBlocks.mine_ap) + if(this == ModBlocks.mine_ap) this.setBlockBounds(6 * f, 0.0F, 6 * f, 10 * f, 2 * f, 10 * f); - if (this == ModBlocks.mine_he) + if(this == ModBlocks.mine_he) this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f); - if (this == ModBlocks.mine_shrap) + if(this == ModBlocks.mine_shrap) this.setBlockBounds(4 * f, 0.0F, 4 * f, 12 * f, 2 * f, 12 * f); - if (this == ModBlocks.mine_fat) + if(this == ModBlocks.mine_fat) this.setBlockBounds(5 * f, 0.0F, 4 * f, 11 * f, 6 * f, 12 * f); - return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, - z + this.maxZ); + return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } public boolean canPlaceBlockAt(World world, int x, int y, int z) { - return World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) - || BlockFence.func_149825_a(world.getBlock(x, y - 1, z)); + return World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) || BlockFence.func_149825_a(world.getBlock(x, y - 1, z)); } - public void onNeighborBlockChange(World world, int x, int y, int z, - Block block) { + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + + if(world.isBlockIndirectlyGettingPowered(x, y, z)) { + explode(world, x, y, z); + } - if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - explode(world, x, y, z); - } - boolean flag = false; - if (!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) - && !BlockFence.func_149825_a(world.getBlock(x, y - 1, z))) { + if(!World.doesBlockHaveSolidTopSurface(world, x, y - 1, z) && !BlockFence.func_149825_a(world.getBlock(x, y - 1, z))) { flag = true; } - if (flag) { - this.dropBlockAsItem(world, x, y, z, - world.getBlockMetadata(x, y, z), 0); + if(flag) { + this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); } } public void breakBlock(World world, int x, int y, int z, Block block, int i) { - if (!safeMode) { + if(!safeMode) { explode(world, x, y, z); } super.breakBlock(world, x, y, z, block, i); } - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, - float fz) { - if (player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.defuser) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) { + if(player.getHeldItem() != null && player.getHeldItem().getItem() == ModItems.defuser) { safeMode = true; world.setBlockToAir(x, y, z); @@ -132,7 +124,7 @@ public class Landmine extends BlockContainer implements IBomb { float f = world.rand.nextFloat() * 0.6F + 0.2F; float f1 = world.rand.nextFloat() * 0.2F; float f2 = world.rand.nextFloat() * 0.6F + 0.2F; - + EntityItem entityitem = new EntityItem(world, x + f, y + f1 + 1, z + f2, itemstack); float f3 = 0.05F; @@ -151,31 +143,32 @@ public class Landmine extends BlockContainer implements IBomb { } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { if(!world.isRemote) { - + Landmine.safeMode = true; world.func_147480_a(x, y, z, false); Landmine.safeMode = false; - - if (this == ModBlocks.mine_ap) { + + if(this == ModBlocks.mine_ap) { world.newExplosion(null, x + 0.5, y + 0.5, z + 0.5, 2.5F, false, false); } - if (this == ModBlocks.mine_he) { + if(this == ModBlocks.mine_he) { ExplosionLarge.explode(world, x + 0.5, y + 0.5, z + 0.5, 10F, true, false, false); } - if (this == ModBlocks.mine_shrap) { + if(this == ModBlocks.mine_shrap) { ExplosionLarge.explode(world, x + 0.5, y + 0.5, z + 0.5, 1, true, false, false); ExplosionLarge.spawnShrapnelShower(world, x + 0.5, y + 0.5, z + 0.5, 0, 1D, 0, 45, 0.2D); ExplosionLarge.spawnShrapnels(world, x + 0.5, y + 0.5, z + 0.5, 5); } - if (this == ModBlocks.mine_fat) { - + if(this == ModBlocks.mine_fat) { ExplosionNukeSmall.explode(world, x + 0.5, y + 0.5, z + 0.5, ExplosionNukeSmall.medium); } } + + return BombReturnCode.DETONATED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/LaunchPad.java b/src/main/java/com/hbm/blocks/bomb/LaunchPad.java index 521ed20a5..5a2c04ff5 100644 --- a/src/main/java/com/hbm/blocks/bomb/LaunchPad.java +++ b/src/main/java/com/hbm/blocks/bomb/LaunchPad.java @@ -170,17 +170,17 @@ public class LaunchPad extends BlockContainer implements IBomb { @Spaghetti("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA *takes breath* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { TileEntityLaunchPad entity = (TileEntityLaunchPad) world.getTileEntity(x, y, z); if(entity.slots[0] == null || world.isRemote) - return; + return BombReturnCode.ERROR_MISSING_COMPONENT; if(entity.slots[1] != null && entity.slots[1].getItem() instanceof IDesignatorItem && entity.power >= 75000) { if(!((IDesignatorItem)entity.slots[1].getItem()).isReady(world, entity.slots[1], x, y, z)) - return; + return BombReturnCode.ERROR_MISSING_COMPONENT; int xCoord = entity.slots[1].stackTagCompound.getInteger("xCoord"); int zCoord = entity.slots[1].stackTagCompound.getInteger("zCoord"); @@ -267,13 +267,18 @@ public class LaunchPad extends BlockContainer implements IBomb { missile = new EntityMissileShuttle(world, x + 0.5F, y + 2F, z + 0.5F, xCoord, zCoord); } - world.spawnEntityInWorld(missile); - world.playSoundEffect(x, y, z, "hbm:weapon.missileTakeOff", 2.0F, 1.0F); - entity.power -= 75000; - entity.slots[0] = null; - - if(GeneralConfig.enableExtendedLogging) - MainRegistry.logger.log(Level.INFO, "[MISSILE] Tried to launch missile at " + x + " / " + y + " / " + z + " to " + xCoord + " / " + zCoord + "!"); + if(missile != null) { + world.spawnEntityInWorld(missile); + world.playSoundEffect(x, y, z, "hbm:weapon.missileTakeOff", 2.0F, 1.0F); + entity.power -= 75000; + entity.slots[0] = null; + + if(GeneralConfig.enableExtendedLogging) + MainRegistry.logger.log(Level.INFO, "[MISSILE] Tried to launch missile at " + x + " / " + y + " / " + z + " to " + xCoord + " / " + zCoord + "!"); + return BombReturnCode.LAUNCHED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; } if(entity.slots[0] != null && entity.slots[0].getItem() == ModItems.missile_carrier && entity.power >= 75000) { @@ -291,6 +296,7 @@ public class LaunchPad extends BlockContainer implements IBomb { entity.slots[0] = null; entity.slots[1] = null; world.playSoundEffect(x, y, z, "hbm:entity.rocketTakeoff", 100.0F, 1.0F); + return BombReturnCode.LAUNCHED; } if(entity.slots[0] != null && entity.slots[0].getItem() == ModItems.missile_anti_ballistic && entity.power >= 75000) { @@ -304,7 +310,10 @@ public class LaunchPad extends BlockContainer implements IBomb { entity.slots[0] = null; world.playSoundEffect(x, y, z, "hbm:weapon.missileTakeOff", 2.0F, 1.0F); + return BombReturnCode.LAUNCHED; } + + return BombReturnCode.ERROR_MISSING_COMPONENT; } } diff --git a/src/main/java/com/hbm/blocks/bomb/LaunchTable.java b/src/main/java/com/hbm/blocks/bomb/LaunchTable.java index 80831a8c4..a90cf06e1 100644 --- a/src/main/java/com/hbm/blocks/bomb/LaunchTable.java +++ b/src/main/java/com/hbm/blocks/bomb/LaunchTable.java @@ -54,17 +54,14 @@ public class LaunchTable extends BlockContainer implements IMultiblock, IBomb { public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(ModBlocks.struct_launcher_core_large); } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityLaunchTable entity = (TileEntityLaunchTable) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_launch_table, world, x, y, z); } return true; @@ -76,7 +73,7 @@ public class LaunchTable extends BlockContainer implements IMultiblock, IBomb { @Override public void onBlockPlacedBy(World worldObj, int xCoord, int yCoord, int zCoord, EntityLivingBase player, ItemStack itemStack) { int d = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - + for(int k = -4; k <= 4; k++) for(int l = -4; l <= 4; l++) if(l != 0 && k != 0) @@ -85,55 +82,55 @@ public class LaunchTable extends BlockContainer implements IMultiblock, IBomb { return; } - if (d == 0) { - + if(d == 0) { + worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2); for(int i = 1; i < 12; i++) worldObj.setBlock(xCoord + 3, yCoord + i, zCoord, Blocks.air); - + for(int i = -4; i <= 4; i++) if(i != 0) placeDummy(worldObj, xCoord + i, yCoord, zCoord, xCoord, yCoord, zCoord, ModBlocks.dummy_port_launch_table); - + for(int i = -4; i <= 4; i++) if(i != 0) placeDummy(worldObj, xCoord, yCoord, zCoord + i, xCoord, yCoord, zCoord, ModBlocks.dummy_plate_launch_table); } - if (d == 1) { + if(d == 1) { worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 2, 2); for(int i = 1; i < 12; i++) worldObj.setBlock(xCoord, yCoord + i, zCoord + 3, Blocks.air); - + for(int i = -4; i <= 4; i++) if(i != 0) placeDummy(worldObj, xCoord + i, yCoord, zCoord, xCoord, yCoord, zCoord, ModBlocks.dummy_plate_launch_table); - + for(int i = -4; i <= 4; i++) if(i != 0) placeDummy(worldObj, xCoord, yCoord, zCoord + i, xCoord, yCoord, zCoord, ModBlocks.dummy_port_launch_table); } - if (d == 2) { + if(d == 2) { worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2); for(int i = 1; i < 12; i++) worldObj.setBlock(xCoord - 3, yCoord + i, zCoord, Blocks.air); - + for(int i = -4; i <= 4; i++) if(i != 0) placeDummy(worldObj, xCoord + i, yCoord, zCoord, xCoord, yCoord, zCoord, ModBlocks.dummy_port_launch_table); - + for(int i = -4; i <= 4; i++) if(i != 0) placeDummy(worldObj, xCoord, yCoord, zCoord + i, xCoord, yCoord, zCoord, ModBlocks.dummy_plate_launch_table); } - if (d == 3) { + if(d == 3) { worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 3, 2); for(int i = 1; i < 12; i++) worldObj.setBlock(xCoord, yCoord + i, zCoord - 3, Blocks.air); - + for(int i = -4; i <= 4; i++) if(i != 0) placeDummy(worldObj, xCoord + i, yCoord, zCoord, xCoord, yCoord, zCoord, ModBlocks.dummy_plate_launch_table); - + for(int i = -4; i <= 4; i++) if(i != 0) placeDummy(worldObj, xCoord, yCoord, zCoord + i, xCoord, yCoord, zCoord, ModBlocks.dummy_port_launch_table); @@ -144,15 +141,15 @@ public class LaunchTable extends BlockContainer implements IMultiblock, IBomb { if(i != 0 && j != 0) placeDummy(worldObj, xCoord + i, yCoord, zCoord + j, xCoord, yCoord, zCoord, ModBlocks.dummy_port_launch_table); } - + private void placeDummy(World world, int x, int y, int z, int xCoord, int yCoord, int zCoord, Block block) { - + world.setBlock(x, y, z, block); - + TileEntity te = world.getTileEntity(x, y, z); - + if(te instanceof TileEntityDummy) { - TileEntityDummy dummy = (TileEntityDummy)te; + TileEntityDummy dummy = (TileEntityDummy) te; dummy.targetX = xCoord; dummy.targetY = yCoord; dummy.targetZ = zCoord; @@ -160,66 +157,67 @@ public class LaunchTable extends BlockContainer implements IMultiblock, IBomb { } @Override - public void explode(World world, int x, int y, int z) { - TileEntityLaunchTable entity = (TileEntityLaunchTable) world.getTileEntity(x, y, z); + public BombReturnCode explode(World world, int x, int y, int z) { - if(entity.canLaunch()) - entity.launch(); + if(!world.isRemote) { + TileEntityLaunchTable entity = (TileEntityLaunchTable) world.getTileEntity(x, y, z); + + if(entity.canLaunch()) { + entity.launch(); + return BombReturnCode.LAUNCHED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + return BombReturnCode.UNDEFINED; } - + public static boolean keepInventory = false; - private final static Random field_149933_a = new Random(); - + private final static Random field_149933_a = new Random(); + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeBalefire.java b/src/main/java/com/hbm/blocks/bomb/NukeBalefire.java index b8e6554f4..0c8d4b7e6 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeBalefire.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeBalefire.java @@ -55,14 +55,20 @@ public class NukeBalefire extends BlockMachineBase implements IBomb, IItemHazard } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { if(!world.isRemote) { TileEntityNukeBalefire bomb = (TileEntityNukeBalefire) world.getTileEntity(x, y, z); - if(bomb.isLoaded()) + if(bomb.isLoaded()) { bomb.explode(); + return BombReturnCode.DETONATED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeBoy.java b/src/main/java/com/hbm/blocks/bomb/NukeBoy.java index 13fd176d8..9952b6cb1 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeBoy.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeBoy.java @@ -4,7 +4,6 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.config.BombConfig; -import com.hbm.entity.effect.EntityNukeCloudNoShroom; import com.hbm.entity.effect.EntityNukeCloudSmall; import com.hbm.entity.logic.EntityNukeExplosionMK4; import com.hbm.interfaces.IBomb; @@ -47,36 +46,31 @@ public class NukeBoy extends BlockContainer implements IBomb { } @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, - int p_149749_6_) { - if (!keepInventory) { - TileEntityNukeBoy tileentityfurnace = (TileEntityNukeBoy) p_149749_1_.getTileEntity(p_149749_2_, - p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityNukeBoy tileentityfurnace = (TileEntityNukeBoy) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) { + if(itemstack != null) { float f = NukeBoy.field_149933_a.nextFloat() * 0.8F + 0.1F; float f1 = NukeBoy.field_149933_a.nextFloat() * 0.8F + 0.1F; float f2 = NukeBoy.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) { + while(itemstack.stackSize > 0) { int j1 = NukeBoy.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) { + if(j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, - p_149749_4_ + f2, - new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) { - entityitem.getEntityItem() - .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } float f3 = 0.05F; @@ -96,13 +90,12 @@ public class NukeBoy extends BlockContainer implements IBomb { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, - float hitY, float hitZ) { - if (world.isRemote) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + if(world.isRemote) { return true; - } else if (!player.isSneaking()) { + } else if(!player.isSneaking()) { TileEntityNukeBoy entity = (TileEntityNukeBoy) world.getTileEntity(x, y, z); - if (entity != null) { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_boy, world, x, y, z); } return true; @@ -114,8 +107,8 @@ public class NukeBoy extends BlockContainer implements IBomb { @Override public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { TileEntityNukeBoy entity = (TileEntityNukeBoy) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) { - if (entity.isReady() && !p_149695_1_.isRemote) { + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) { + if(entity.isReady() && !p_149695_1_.isRemote) { this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); entity.clearSlots(); p_149695_1_.setBlockToAir(x, y, z); @@ -125,12 +118,12 @@ public class NukeBoy extends BlockContainer implements IBomb { } public boolean igniteTestBomb(World world, int x, int y, int z) { - if (!world.isRemote) { - + if(!world.isRemote) { + tetn.clearSlots(); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); - - world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, BombConfig.boyRadius, x + 0.5, y + 0.5, z + 0.5)); + + world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, BombConfig.boyRadius, x + 0.5, y + 0.5, z + 0.5)); world.spawnEntityInWorld(EntityNukeCloudSmall.statFac(world, x, y, z, BombConfig.boyRadius)); } return false; @@ -155,31 +148,37 @@ public class NukeBoy extends BlockContainer implements IBomb { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - if (i == 0) { + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if (i == 1) { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if (i == 2) { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if (i == 3) { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukeBoy entity = (TileEntityNukeBoy) world.getTileEntity(x, y, z); - // if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - if (entity.isReady()) { + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityNukeBoy entity = (TileEntityNukeBoy) world.getTileEntity(x, y, z); + + if(entity.isReady()) { this.onBlockDestroyedByPlayer(world, x, y, z, 1); entity.clearSlots(); world.setBlockToAir(x, y, z); igniteTestBomb(world, x, y, z); + return BombReturnCode.DETONATED; } + + return BombReturnCode.ERROR_MISSING_COMPONENT; } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeCustom.java b/src/main/java/com/hbm/blocks/bomb/NukeCustom.java index c6f0ded70..ea68fc866 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeCustom.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeCustom.java @@ -3,7 +3,6 @@ package com.hbm.blocks.bomb; import java.util.Random; import com.hbm.blocks.ModBlocks; -import com.hbm.config.BombConfig; import com.hbm.entity.effect.EntityCloudFleija; import com.hbm.entity.effect.EntityNukeCloudSmall; import com.hbm.entity.grenade.EntityGrenadeZOMG; @@ -14,7 +13,6 @@ import com.hbm.entity.projectile.EntityFallingNuke; import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.ExplosionLarge; import com.hbm.interfaces.IBomb; -import com.hbm.interfaces.Untested; import com.hbm.main.MainRegistry; import com.hbm.tileentity.bomb.TileEntityNukeCustom; @@ -125,7 +123,7 @@ public class NukeCustom extends BlockContainer implements IBomb { @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) { - if (world.isBlockIndirectlyGettingPowered(x, y, z) && !world.isRemote) { + if(world.isBlockIndirectlyGettingPowered(x, y, z)) { this.explode(world, x, y, z); } } @@ -236,25 +234,30 @@ public class NukeCustom extends BlockContainer implements IBomb { } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { - TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z); - - if(!entity.isFalling()) { + if(!world.isRemote) { + TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z); - entity.clearSlots(); - world.func_147480_a(x, y, z, false); - NukeCustom.explodeCustom(world, x + 0.5, y + 0.5, z + 0.5, entity.tnt, entity.nuke, entity.hydro, entity.amat, entity.dirty, entity.schrab, entity.euph); - - } else { - - EntityFallingNuke bomb = new EntityFallingNuke(world, entity.tnt, entity.nuke, entity.hydro, entity.amat, entity.dirty, entity.schrab, entity.euph); - bomb.getDataWatcher().updateObject(20, (byte)world.getBlockMetadata(x, y, z)); - bomb.setPositionAndRotation(x + 0.5, y, z + 0.5, 0, 0); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - world.spawnEntityInWorld(bomb); + if(!entity.isFalling()) { + + entity.clearSlots(); + world.func_147480_a(x, y, z, false); + NukeCustom.explodeCustom(world, x + 0.5, y + 0.5, z + 0.5, entity.tnt, entity.nuke, entity.hydro, entity.amat, entity.dirty, entity.schrab, entity.euph); + return BombReturnCode.DETONATED; + + } else { + + EntityFallingNuke bomb = new EntityFallingNuke(world, entity.tnt, entity.nuke, entity.hydro, entity.amat, entity.dirty, entity.schrab, entity.euph); + bomb.getDataWatcher().updateObject(20, (byte)world.getBlockMetadata(x, y, z)); + bomb.setPositionAndRotation(x + 0.5, y, z + 0.5, 0, 0); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + world.spawnEntityInWorld(bomb); + return BombReturnCode.TRIGGERED; + } } + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeFleija.java b/src/main/java/com/hbm/blocks/bomb/NukeFleija.java index 091b59cb0..7c1956656 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeFleija.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeFleija.java @@ -1,7 +1,5 @@ package com.hbm.blocks.bomb; -import java.util.HashMap; -import java.util.Map; import java.util.Random; import com.hbm.blocks.ModBlocks; @@ -30,7 +28,7 @@ public class NukeFleija extends BlockContainer implements IBomb { public TileEntityNukeFleija tetn = new TileEntityNukeFleija(); - private final Random field_149933_a = new Random(); + private final Random field_149933_a = new Random(); private static boolean keepInventory = false; public NukeFleija(Material p_i45386_1_) { @@ -41,75 +39,63 @@ public class NukeFleija extends BlockContainer implements IBomb { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityNukeFleija(); } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.nuke_fleija); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.nuke_fleija); + } + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - TileEntityNukeFleija tileentityfurnace = (TileEntityNukeFleija)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityNukeFleija tileentityfurnace = (TileEntityNukeFleija) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityNukeFleija entity = (TileEntityNukeFleija) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_fleija, world, x, y, z); } return true; @@ -117,91 +103,86 @@ public class NukeFleija extends BlockContainer implements IBomb { return false; } } - - @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - TileEntityNukeFleija entity = (TileEntityNukeFleija) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); - entity.clearSlots(); - p_149695_1_.setBlockToAir(x, y, z); - igniteTestBomb(p_149695_1_, x, y, z, BombConfig.fleijaRadius); - } - } - } - - public boolean igniteTestBomb(World world, int x, int y, int z, int r) - { - if (!world.isRemote) - { - //world.spawnParticle("hugeexplosion", x, y, z, 0, 0, 0); + + @Override + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + TileEntityNukeFleija entity = (TileEntityNukeFleija) p_149695_1_.getTileEntity(x, y, z); + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); + entity.clearSlots(); + p_149695_1_.setBlockToAir(x, y, z); + igniteTestBomb(p_149695_1_, x, y, z, BombConfig.fleijaRadius); + } + } + } + + public boolean igniteTestBomb(World world, int x, int y, int z, int r) { + if(!world.isRemote) { + // world.spawnParticle("hugeexplosion", x, y, z, 0, 0, 0); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK3.statFacFleija(world, x + 0.5, y + 0.5, z + 0.5, r)); - - EntityCloudFleija cloud = new EntityCloudFleija(world, r); - cloud.posX = x; - cloud.posY = y; - cloud.posZ = z; - world.spawnEntityInWorld(cloud); - } - + + EntityCloudFleija cloud = new EntityCloudFleija(world, r); + cloud.posX = x; + cloud.posY = y; + cloud.posZ = z; + world.spawnEntityInWorld(cloud); + } + return false; } - + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukeFleija entity = (TileEntityNukeFleija) world.getTileEntity(x, y, z); - //if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - igniteTestBomb(world, x, y, z, BombConfig.fleijaRadius); - } - } + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityNukeFleija entity = (TileEntityNukeFleija) world.getTileEntity(x, y, z); + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(world, x, y, z, 1); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + igniteTestBomb(world, x, y, z, BombConfig.fleijaRadius); + return BombReturnCode.DETONATED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeGadget.java b/src/main/java/com/hbm/blocks/bomb/NukeGadget.java index 8a4ddbda8..0c88670ff 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeGadget.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeGadget.java @@ -176,16 +176,21 @@ public class NukeGadget extends BlockContainer implements IBomb { } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukeGadget entity = (TileEntityNukeGadget) world.getTileEntity(x, y, z); - // if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityNukeGadget entity = (TileEntityNukeGadget) world.getTileEntity(x, y, z); if (entity.isReady()) { this.onBlockDestroyedByPlayer(world, x, y, z, 1); entity.clearSlots(); world.setBlockToAir(x, y, z); igniteTestBomb(world, x, y, z); + return BombReturnCode.DETONATED; } + + return BombReturnCode.ERROR_MISSING_COMPONENT; } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeMan.java b/src/main/java/com/hbm/blocks/bomb/NukeMan.java index 6d331d632..eab7de663 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeMan.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeMan.java @@ -28,7 +28,7 @@ public class NukeMan extends BlockContainer implements IBomb { public TileEntityNukeMan tetn = new TileEntityNukeMan(); - private final Random field_149933_a = new Random(); + private final Random field_149933_a = new Random(); private static boolean keepInventory = false; public NukeMan(Material p_i45386_1_) { @@ -38,77 +38,65 @@ public class NukeMan extends BlockContainer implements IBomb { @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityNukeMan(); - + } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.nuke_man); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.nuke_man); + } + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - TileEntityNukeMan tileentityfurnace = (TileEntityNukeMan)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityNukeMan tileentityfurnace = (TileEntityNukeMan) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityNukeMan entity = (TileEntityNukeMan) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_man, world, x, y, z); } return true; @@ -116,25 +104,21 @@ public class NukeMan extends BlockContainer implements IBomb { return false; } } - - @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - TileEntityNukeMan entity = (TileEntityNukeMan) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); - entity.clearSlots(); - p_149695_1_.setBlockToAir(x, y, z); - igniteTestBomb(p_149695_1_, x, y, z); - } - } - } - - public boolean igniteTestBomb(World world, int x, int y, int z) - { + + @Override + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + TileEntityNukeMan entity = (TileEntityNukeMan) p_149695_1_.getTileEntity(x, y, z); + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); + entity.clearSlots(); + p_149695_1_.setBlockToAir(x, y, z); + igniteTestBomb(p_149695_1_, x, y, z); + } + } + } + + public boolean igniteTestBomb(World world, int x, int y, int z) { if(!world.isRemote) { tetn.clearSlots(); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); @@ -150,56 +134,56 @@ public class NukeMan extends BlockContainer implements IBomb { return false; } - + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukeMan entity = (TileEntityNukeMan) world.getTileEntity(x, y, z); - //if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - igniteTestBomb(world, x, y, z); - } - } + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityNukeMan entity = (TileEntityNukeMan) world.getTileEntity(x, y, z); + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(world, x, y, z, 1); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + igniteTestBomb(world, x, y, z); + return BombReturnCode.DETONATED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeMike.java b/src/main/java/com/hbm/blocks/bomb/NukeMike.java index 6b161343e..458428a74 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeMike.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeMike.java @@ -1,7 +1,5 @@ package com.hbm.blocks.bomb; -import java.util.HashMap; -import java.util.Map; import java.util.Random; import com.hbm.blocks.ModBlocks; @@ -34,7 +32,6 @@ public class NukeMike extends BlockContainer implements IBomb { private final Random field_149933_a = new Random(); private static boolean keepInventory = false; - private Map field_77288_k = new HashMap(); public NukeMike(Material p_i45386_1_) { super(p_i45386_1_); @@ -51,36 +48,31 @@ public class NukeMike extends BlockContainer implements IBomb { } @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, - int p_149749_6_) { - if (!keepInventory) { - TileEntityNukeMike tileentityfurnace = (TileEntityNukeMike) p_149749_1_.getTileEntity(p_149749_2_, - p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityNukeMike tileentityfurnace = (TileEntityNukeMike) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) { + if(itemstack != null) { float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) { + while(itemstack.stackSize > 0) { int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) { + if(j1 > itemstack.stackSize) { j1 = itemstack.stackSize; } itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, - p_149749_4_ + f2, - new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) { - entityitem.getEntityItem() - .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); } float f3 = 0.05F; @@ -100,13 +92,12 @@ public class NukeMike extends BlockContainer implements IBomb { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, - float hitY, float hitZ) { - if (world.isRemote) { + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + if(world.isRemote) { return true; - } else if (!player.isSneaking()) { + } else if(!player.isSneaking()) { TileEntityNukeMike entity = (TileEntityNukeMike) world.getTileEntity(x, y, z); - if (entity != null) { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_mike, world, x, y, z); } return true; @@ -118,15 +109,15 @@ public class NukeMike extends BlockContainer implements IBomb { @Override public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { TileEntityNukeMike entity = (TileEntityNukeMike) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { - if (entity.isReady() && !entity.isFilled()) { + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { + if(entity.isReady() && !entity.isFilled()) { this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); entity.clearSlots(); p_149695_1_.setBlockToAir(x, y, z); igniteTestBomb(p_149695_1_, x, y, z, BombConfig.manRadius); } - if (entity.isFilled()) { + if(entity.isFilled()) { this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); entity.clearSlots(); p_149695_1_.setBlockToAir(x, y, z); @@ -136,14 +127,14 @@ public class NukeMike extends BlockContainer implements IBomb { } public boolean igniteTestBomb(World world, int x, int y, int z, int r) { - if (!world.isRemote) { + if(!world.isRemote) { tetn.clearSlots(); // world.spawnParticle("hugeexplosion", x, y, z, 0, 0, 0); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); - world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, BombConfig.mikeRadius, x + 0.5, y + 0.5, z + 0.5)); + world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, BombConfig.mikeRadius, x + 0.5, y + 0.5, z + 0.5)); - if (GeneralConfig.enableNukeClouds) { + if(GeneralConfig.enableNukeClouds) { EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, r * 0.005F); entity2.posX = x; entity2.posY = y; @@ -182,39 +173,46 @@ public class NukeMike extends BlockContainer implements IBomb { public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - if (i == 0) { + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if (i == 1) { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if (i == 2) { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if (i == 3) { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukeMike entity = (TileEntityNukeMike) world.getTileEntity(x, y, z); - // if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - if (entity.isReady() && !entity.isFilled()) { + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + + TileEntityNukeMike entity = (TileEntityNukeMike) world.getTileEntity(x, y, z); + if(entity.isReady() && !entity.isFilled()) { this.onBlockDestroyedByPlayer(world, x, y, z, 1); entity.clearSlots(); world.setBlockToAir(x, y, z); igniteTestBomb(world, x, y, z, BombConfig.manRadius); + return BombReturnCode.DETONATED; } - if (entity.isFilled()) { + if(entity.isFilled()) { this.onBlockDestroyedByPlayer(world, x, y, z, 1); entity.clearSlots(); world.setBlockToAir(x, y, z); igniteTestBomb(world, x, y, z, BombConfig.mikeRadius); + return BombReturnCode.DETONATED; } + + return BombReturnCode.ERROR_MISSING_COMPONENT; } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeN2.java b/src/main/java/com/hbm/blocks/bomb/NukeN2.java index 38b115708..c92b3a887 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeN2.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeN2.java @@ -26,7 +26,7 @@ import net.minecraft.world.World; public class NukeN2 extends BlockContainer implements IBomb { - private final Random field_149933_a = new Random(); + private final Random field_149933_a = new Random(); private static boolean keepInventory = false; public NukeN2(Material p_i45386_1_) { @@ -37,75 +37,63 @@ public class NukeN2 extends BlockContainer implements IBomb { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityNukeN2(); } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.nuke_n2); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.nuke_n2); + } + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - TileEntityNukeN2 tileentityfurnace = (TileEntityNukeN2)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityNukeN2 tileentityfurnace = (TileEntityNukeN2) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityNukeN2 entity = (TileEntityNukeN2) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_n2, world, x, y, z); } return true; @@ -113,90 +101,86 @@ public class NukeN2 extends BlockContainer implements IBomb { return false; } } - - @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - TileEntityNukeN2 entity = (TileEntityNukeN2) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); - entity.clearSlots(); - p_149695_1_.setBlockToAir(x, y, z); - igniteTestBomb(p_149695_1_, x, y, z, BombConfig.n2Radius); - } - } - } - - public boolean igniteTestBomb(World world, int x, int y, int z, int r) - { - if (!world.isRemote) - { + + @Override + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + TileEntityNukeN2 entity = (TileEntityNukeN2) p_149695_1_.getTileEntity(x, y, z); + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); + entity.clearSlots(); + p_149695_1_.setBlockToAir(x, y, z); + igniteTestBomb(p_149695_1_, x, y, z, BombConfig.n2Radius); + } + } + } + + public boolean igniteTestBomb(World world, int x, int y, int z, int r) { + if(!world.isRemote) { world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); - world.spawnEntityInWorld(EntityNukeExplosionMK4.statFacNoRad(world, r, x + 0.5, y + 0.5, z + 0.5)); - + world.spawnEntityInWorld(EntityNukeExplosionMK4.statFacNoRad(world, r, x + 0.5, y + 0.5, z + 0.5)); + EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, r * 0.005F); entity2.posX = x; entity2.posY = y; entity2.posZ = z; world.spawnEntityInWorld(entity2); - } - + } + return false; } - + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukeN2 entity = (TileEntityNukeN2) world.getTileEntity(x, y, z); - //if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - igniteTestBomb(world, x, y, z, BombConfig.n2Radius); - } - } + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityNukeN2 entity = (TileEntityNukeN2) world.getTileEntity(x, y, z); + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(world, x, y, z, 1); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + igniteTestBomb(world, x, y, z, BombConfig.n2Radius); + + return BombReturnCode.DETONATED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeN45.java b/src/main/java/com/hbm/blocks/bomb/NukeN45.java index 810367655..a6d2ca3ce 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeN45.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeN45.java @@ -22,9 +22,9 @@ import net.minecraft.world.World; public class NukeN45 extends BlockContainer implements IBomb { - private final Random field_149933_a = new Random(); + private final Random field_149933_a = new Random(); private static boolean keepInventory = false; - + public NukeN45(Material p_i45386_1_) { super(p_i45386_1_); } @@ -33,69 +33,58 @@ public class NukeN45 extends BlockContainer implements IBomb { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityNukeN45(); } - + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - ISidedInventory tileentityfurnace = (ISidedInventory)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + ISidedInventory tileentityfurnace = (ISidedInventory) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityNukeN45 entity = (TileEntityNukeN45) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_n45, world, x, y, z); } return true; @@ -103,39 +92,46 @@ public class NukeN45 extends BlockContainer implements IBomb { return false; } } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.nuke_n45); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.nuke_n45); + } + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { - TileEntityNukeN45 entity = (TileEntityNukeN45) world.getTileEntity(x, y, z); - - if(entity.getType() == 100) { - entity.primed = true; - } else if(!entity.primed && entity.getType() > 0) { - int t = entity.getType(); - entity.clearSlots(); - entity.explode(world, x, y, z, t); + if(!world.isRemote) { + TileEntityNukeN45 entity = (TileEntityNukeN45) world.getTileEntity(x, y, z); + + if(entity.getType() == 100) { + entity.primed = true; + return BombReturnCode.TRIGGERED; + } else if(!entity.primed && entity.getType() > 0) { + int t = entity.getType(); + entity.clearSlots(); + entity.explode(world, x, y, z, t); + return BombReturnCode.DETONATED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukePrototype.java b/src/main/java/com/hbm/blocks/bomb/NukePrototype.java index bd1d8bca3..f4ed4bb9c 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukePrototype.java +++ b/src/main/java/com/hbm/blocks/bomb/NukePrototype.java @@ -1,7 +1,5 @@ package com.hbm.blocks.bomb; -import java.util.HashMap; -import java.util.Map; import java.util.Random; import com.hbm.blocks.ModBlocks; @@ -31,9 +29,8 @@ public class NukePrototype extends BlockContainer implements IBomb { public TileEntityNukePrototype tetn = new TileEntityNukePrototype(); - private final Random field_149933_a = new Random(); + private final Random field_149933_a = new Random(); private static boolean keepInventory = false; - private Map field_77288_k = new HashMap(); public NukePrototype(Material p_i45386_1_) { super(p_i45386_1_); @@ -43,85 +40,72 @@ public class NukePrototype extends BlockContainer implements IBomb { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityNukePrototype(); } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.nuke_prototype); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.nuke_prototype); + } + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - TileEntityNukePrototype tileentityfurnace = (TileEntityNukePrototype)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityNukePrototype tileentityfurnace = (TileEntityNukePrototype) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; } else if(!player.isSneaking() && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ModItems.igniter) { TileEntityNukePrototype entity = (TileEntityNukePrototype) world.getTileEntity(x, y, z); - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - igniteTestBomb(world, x, y, z, BombConfig.prototypeRadius); + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(world, x, y, z, 1); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + igniteTestBomb(world, x, y, z, BombConfig.prototypeRadius); } return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityNukePrototype entity = (TileEntityNukePrototype) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_prototype, world, x, y, z); } return true; @@ -129,92 +113,87 @@ public class NukePrototype extends BlockContainer implements IBomb { return false; } } - - @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - TileEntityNukePrototype entity = (TileEntityNukePrototype) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); - entity.clearSlots(); - p_149695_1_.setBlockToAir(x, y, z); - igniteTestBomb(p_149695_1_, x, y, z, BombConfig.prototypeRadius); - } - } - } - - public boolean igniteTestBomb(World world, int x, int y, int z, int r) - { - if (!world.isRemote) - { + + @Override + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + TileEntityNukePrototype entity = (TileEntityNukePrototype) p_149695_1_.getTileEntity(x, y, z); + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); + entity.clearSlots(); + p_149695_1_.setBlockToAir(x, y, z); + igniteTestBomb(p_149695_1_, x, y, z, BombConfig.prototypeRadius); + } + } + } + + public boolean igniteTestBomb(World world, int x, int y, int z, int r) { + if(!world.isRemote) { tetn.clearSlots(); - //world.spawnParticle("hugeexplosion", x, y, z, 0, 0, 0); + // world.spawnParticle("hugeexplosion", x, y, z, 0, 0, 0); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK3.statFacFleija(world, x + 0.5, y + 0.5, z + 0.5, r)); - - EntityCloudFleija cloud = new EntityCloudFleija(world, r); - cloud.posX = x; - cloud.posY = y; - cloud.posZ = z; - world.spawnEntityInWorld(cloud); - } - + + EntityCloudFleija cloud = new EntityCloudFleija(world, r); + cloud.posX = x; + cloud.posY = y; + cloud.posZ = z; + world.spawnEntityInWorld(cloud); + } + return false; } - + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukePrototype entity = (TileEntityNukePrototype) world.getTileEntity(x, y, z); - //if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - igniteTestBomb(world, x, y, z, BombConfig.prototypeRadius); - } - } + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityNukePrototype entity = (TileEntityNukePrototype) world.getTileEntity(x, y, z); + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(world, x, y, z, 1); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + igniteTestBomb(world, x, y, z, BombConfig.prototypeRadius); + return BombReturnCode.DETONATED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeSolinium.java b/src/main/java/com/hbm/blocks/bomb/NukeSolinium.java index 761cfab5f..c47d68ef4 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeSolinium.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeSolinium.java @@ -1,7 +1,5 @@ package com.hbm.blocks.bomb; -import java.util.HashMap; -import java.util.Map; import java.util.Random; import com.hbm.blocks.ModBlocks; @@ -28,9 +26,8 @@ import net.minecraft.world.World; public class NukeSolinium extends BlockContainer implements IBomb { - private final Random field_149933_a = new Random(); + private final Random field_149933_a = new Random(); private static boolean keepInventory = false; - private Map field_77288_k = new HashMap(); public NukeSolinium(Material p_i45386_1_) { super(p_i45386_1_); @@ -40,75 +37,63 @@ public class NukeSolinium extends BlockContainer implements IBomb { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityNukeSolinium(); } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.nuke_solinium); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.nuke_solinium); + } + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - TileEntityNukeSolinium tileentityfurnace = (TileEntityNukeSolinium)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityNukeSolinium tileentityfurnace = (TileEntityNukeSolinium) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityNukeSolinium entity = (TileEntityNukeSolinium) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_solinium, world, x, y, z); } return true; @@ -116,89 +101,84 @@ public class NukeSolinium extends BlockContainer implements IBomb { return false; } } - - @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - TileEntityNukeSolinium entity = (TileEntityNukeSolinium) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); - entity.clearSlots(); - p_149695_1_.setBlockToAir(x, y, z); - igniteTestBomb(p_149695_1_, x, y, z, BombConfig.soliniumRadius); - } - } - } - - public boolean igniteTestBomb(World world, int x, int y, int z, int r) - { - if (!world.isRemote) - { + + @Override + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + TileEntityNukeSolinium entity = (TileEntityNukeSolinium) p_149695_1_.getTileEntity(x, y, z); + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); + entity.clearSlots(); + p_149695_1_.setBlockToAir(x, y, z); + igniteTestBomb(p_149695_1_, x, y, z, BombConfig.soliniumRadius); + } + } + } + + public boolean igniteTestBomb(World world, int x, int y, int z, int r) { + if(!world.isRemote) { world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK3.statFacFleija(world, x + 0.5, y + 0.5, z + 0.5, r).makeSol()); - - EntityCloudSolinium cloud = new EntityCloudSolinium(world, r); - cloud.posX = x; - cloud.posY = y; - cloud.posZ = z; - world.spawnEntityInWorld(cloud); - } - + + EntityCloudSolinium cloud = new EntityCloudSolinium(world, r); + cloud.posX = x; + cloud.posY = y; + cloud.posZ = z; + world.spawnEntityInWorld(cloud); + } + return false; } - + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukeSolinium entity = (TileEntityNukeSolinium) world.getTileEntity(x, y, z); - //if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - if(entity.isReady()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - igniteTestBomb(world, x, y, z, BombConfig.soliniumRadius); - } - } + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityNukeSolinium entity = (TileEntityNukeSolinium) world.getTileEntity(x, y, z); + if(entity.isReady()) { + this.onBlockDestroyedByPlayer(world, x, y, z, 1); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + igniteTestBomb(world, x, y, z, BombConfig.soliniumRadius); + return BombReturnCode.DETONATED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeTsar.java b/src/main/java/com/hbm/blocks/bomb/NukeTsar.java index 820b45ab8..1f02c559b 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeTsar.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeTsar.java @@ -1,7 +1,5 @@ package com.hbm.blocks.bomb; -import java.util.HashMap; -import java.util.Map; import java.util.Random; import com.hbm.blocks.ModBlocks; @@ -30,9 +28,8 @@ public class NukeTsar extends BlockContainer implements IBomb { public TileEntityNukeTsar tetn = new TileEntityNukeTsar(); - private final Random field_149933_a = new Random(); + private final Random field_149933_a = new Random(); private static boolean keepInventory = false; - private Map field_77288_k = new HashMap(); public NukeTsar(Material p_i45386_1_) { super(p_i45386_1_); @@ -42,75 +39,63 @@ public class NukeTsar extends BlockContainer implements IBomb { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityNukeTsar(); } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(ModBlocks.nuke_tsar); - } - + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(ModBlocks.nuke_tsar); + } + @Override - public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) - { - if (!keepInventory) - { - TileEntityNukeTsar tileentityfurnace = (TileEntityNukeTsar)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); + public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) { + if(!keepInventory) { + TileEntityNukeTsar tileentityfurnace = (TileEntityNukeTsar) p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_); - if (tileentityfurnace != null) - { - for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) - { - ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); + if(tileentityfurnace != null) { + for(int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1) { + ItemStack itemstack = tileentityfurnace.getStackInSlot(i1); - if (itemstack != null) - { - float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + if(itemstack != null) { + float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; + float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F; - while (itemstack.stackSize > 0) - { - int j1 = this.field_149933_a.nextInt(21) + 10; + while(itemstack.stackSize > 0) { + int j1 = this.field_149933_a.nextInt(21) + 10; - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } + if(j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } - float f3 = 0.05F; - entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3; - entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3; - p_149749_1_.spawnEntityInWorld(entityitem); - } - } - } + float f3 = 0.05F; + entityitem.motionX = (float) this.field_149933_a.nextGaussian() * f3; + entityitem.motionY = (float) this.field_149933_a.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) this.field_149933_a.nextGaussian() * f3; + p_149749_1_.spawnEntityInWorld(entityitem); + } + } + } - p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); - } - } + p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_); + } + } + + super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); + } - super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_); - } - @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { TileEntityNukeTsar entity = (TileEntityNukeTsar) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_tsar, world, x, y, z); } return true; @@ -118,111 +103,105 @@ public class NukeTsar extends BlockContainer implements IBomb { return false; } } - - @Override - public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) - { - TileEntityNukeTsar entity = (TileEntityNukeTsar) p_149695_1_.getTileEntity(x, y, z); - if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) - { - if(entity.isReady() && !entity.isFilled()) - { - this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); - entity.clearSlots(); - p_149695_1_.setBlockToAir(x, y, z); - igniteTestBomb(p_149695_1_, x, y, z, BombConfig.manRadius); - } - - if(entity.isFilled()) - { - this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); - entity.clearSlots(); - p_149695_1_.setBlockToAir(x, y, z); - igniteTestBomb(p_149695_1_, x, y, z, BombConfig.tsarRadius); - } - } - } - - public boolean igniteTestBomb(World world, int x, int y, int z, int r) - { - if (!world.isRemote) - { + + @Override + public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { + TileEntityNukeTsar entity = (TileEntityNukeTsar) p_149695_1_.getTileEntity(x, y, z); + if(p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { + if(entity.isReady() && !entity.isFilled()) { + this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); + entity.clearSlots(); + p_149695_1_.setBlockToAir(x, y, z); + igniteTestBomb(p_149695_1_, x, y, z, BombConfig.manRadius); + } + + if(entity.isFilled()) { + this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1); + entity.clearSlots(); + p_149695_1_.setBlockToAir(x, y, z); + igniteTestBomb(p_149695_1_, x, y, z, BombConfig.tsarRadius); + } + } + } + + public boolean igniteTestBomb(World world, int x, int y, int z, int r) { + if(!world.isRemote) { tetn.clearSlots(); - //world.spawnParticle("hugeexplosion", x, y, z, 0, 0, 0); + // world.spawnParticle("hugeexplosion", x, y, z, 0, 0, 0); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); - world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, r, x + 0.5, y + 0.5, z + 0.5)); - + world.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(world, r, x + 0.5, y + 0.5, z + 0.5)); + EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, r * 0.005F); entity2.posX = x; entity2.posY = y; entity2.posZ = z; world.spawnEntityInWorld(entity2); - - //ExplosionNukeAdvanced.mush(world, x, y, z); - } - + + // ExplosionNukeAdvanced.mush(world, x, y, z); + } + return false; } - + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } } @Override - public void explode(World world, int x, int y, int z) { - TileEntityNukeTsar entity = (TileEntityNukeTsar) world.getTileEntity(x, y, z); - //if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z)) - { - if(entity.isReady() && !entity.isFilled()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - igniteTestBomb(world, x, y, z, BombConfig.manRadius); - } - - if(entity.isFilled()) - { - this.onBlockDestroyedByPlayer(world, x, y, z, 1); - entity.clearSlots(); - world.setBlockToAir(x, y, z); - igniteTestBomb(world, x, y, z, BombConfig.tsarRadius); - } - } + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityNukeTsar entity = (TileEntityNukeTsar) world.getTileEntity(x, y, z); + if(entity.isReady() && !entity.isFilled()) { + this.onBlockDestroyedByPlayer(world, x, y, z, 1); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + igniteTestBomb(world, x, y, z, BombConfig.manRadius); + return BombReturnCode.DETONATED; + } + + if(entity.isFilled()) { + this.onBlockDestroyedByPlayer(world, x, y, z, 1); + entity.clearSlots(); + world.setBlockToAir(x, y, z); + igniteTestBomb(world, x, y, z, BombConfig.tsarRadius); + return BombReturnCode.DETONATED; + } + + return BombReturnCode.ERROR_MISSING_COMPONENT; + } + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/generic/WasteEarth.java b/src/main/java/com/hbm/blocks/generic/WasteEarth.java index 9d6e28078..e6e876f24 100644 --- a/src/main/java/com/hbm/blocks/generic/WasteEarth.java +++ b/src/main/java/com/hbm/blocks/generic/WasteEarth.java @@ -175,7 +175,7 @@ public class WasteEarth extends Block { if(this == ModBlocks.burning_earth) { Block b = world.getBlock(x, y + 1, z); - if(b instanceof BlockLiquid || b instanceof BlockFluidBase || b.isBlockNormalCube()) { + if(b instanceof BlockLiquid || b instanceof BlockFluidBase || b.isNormalCube()) { world.setBlock(x, y, z, Blocks.dirt); } } diff --git a/src/main/java/com/hbm/blocks/machine/BlastDoor.java b/src/main/java/com/hbm/blocks/machine/BlastDoor.java index 384b810cf..311b93a21 100644 --- a/src/main/java/com/hbm/blocks/machine/BlastDoor.java +++ b/src/main/java/com/hbm/blocks/machine/BlastDoor.java @@ -42,14 +42,22 @@ public class BlastDoor extends BlockContainer implements IBomb, IMultiblock { } @Override - public void explode(World world, int x, int y, int z) { - TileEntityBlastDoor entity = (TileEntityBlastDoor) world.getTileEntity(x, y, z); - if(entity != null) - { - if(!entity.isLocked()) { - entity.tryToggle(); + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityBlastDoor entity = (TileEntityBlastDoor) world.getTileEntity(x, y, z); + if(entity != null) { + + if(!entity.isLocked()) { + entity.tryToggle(); + return BombReturnCode.TRIGGERED; + } + + return BombReturnCode.ERROR_INCOMPATIBLE; } } + + return BombReturnCode.UNDEFINED; } @Override diff --git a/src/main/java/com/hbm/blocks/machine/BlockSeal.java b/src/main/java/com/hbm/blocks/machine/BlockSeal.java index 8e1f5e23a..7a9c2c7d1 100644 --- a/src/main/java/com/hbm/blocks/machine/BlockSeal.java +++ b/src/main/java/com/hbm/blocks/machine/BlockSeal.java @@ -26,18 +26,18 @@ public class BlockSeal extends Block implements IBomb { @SideOnly(Side.CLIENT) private IIcon iconTop; - + public BlockSeal(Material p_i45394_1_) { super(p_i45394_1_); } - + @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":seal_frame"); this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":seal_controller"); } - + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { @@ -46,101 +46,57 @@ public class BlockSeal extends Block implements IBomb { metadata += 4; return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : (metadata == 0 && side == 3 ? this.blockIcon : (side == metadata ? this.blockIcon : this.iconTop))); } - + @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return Item.getItemFromBlock(this); - } - - @Override - public void onBlockAdded(World world, int x, int y, int z) { - super.onBlockAdded(world, x, y, z); - //this.setDefaultDirection(world, x, y, z); + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return Item.getItemFromBlock(this); } - - private void setDefaultDirection(World world, int x, int y, int z) { - if(!world.isRemote) - { - Block block1 = world.getBlock(x, y, z - 1); - Block block2 = world.getBlock(x, y, z + 1); - Block block3 = world.getBlock(x - 1, y, z); - Block block4 = world.getBlock(x + 1, y, z); - - byte b0 = 3; - - if(block1.func_149730_j() && !block2.func_149730_j()) - { - b0 = 3; - } - if(block2.func_149730_j() && !block1.func_149730_j()) - { - b0 = 2; - } - if(block3.func_149730_j() && !block4.func_149730_j()) - { - b0 = 1; - } - if(block4.func_149730_j() && !block3.func_149730_j()) - { - b0 = 0; - } - - world.setBlockMetadataWithNotify(x, y, z, b0, 2); - } - } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 1, 2); } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 0, 2); } } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; - } else if(!player.isSneaking()) - { + } else if(!player.isSneaking()) { int i = BlockSeal.getFrameSize(world, x, y, z); - + if(i != 0) if(BlockSeal.isSealClosed(world, x, y, z, i)) BlockSeal.openSeal(world, x, y, z, i); else BlockSeal.closeSeal(world, x, y, z, i); - + return true; } else { return false; } } - + public static int getFrameSize(World world, int x, int y, int z) { - + int max = 7; - - for(int size = 1; size < max; size ++) { - + + for(int size = 1; size < max; size++) { + boolean valid = true; - + int xOff = 0; int zOff = 0; if(world.getBlockMetadata(x, y, z) % 4 == 2) @@ -152,43 +108,38 @@ public class BlockSeal extends Block implements IBomb { if(world.getBlockMetadata(x, y, z) % 4 == 1) xOff -= size; - for(int X = x - size; X <= x + size; X ++) { - if(world.getBlock(X + xOff, y, z + size + zOff) != ModBlocks.seal_frame && - world.getBlock(X + xOff, y, z + size + zOff) != ModBlocks.seal_controller) + for(int X = x - size; X <= x + size; X++) { + if(world.getBlock(X + xOff, y, z + size + zOff) != ModBlocks.seal_frame && world.getBlock(X + xOff, y, z + size + zOff) != ModBlocks.seal_controller) valid = false; } - for(int X = x - size; X <= x + size; X ++) { - if(world.getBlock(X + xOff, y, z - size + zOff) != ModBlocks.seal_frame && - world.getBlock(X + xOff, y, z - size + zOff) != ModBlocks.seal_controller) + for(int X = x - size; X <= x + size; X++) { + if(world.getBlock(X + xOff, y, z - size + zOff) != ModBlocks.seal_frame && world.getBlock(X + xOff, y, z - size + zOff) != ModBlocks.seal_controller) valid = false; } - for(int Z = z - size; Z <= z + size; Z ++) { - if(world.getBlock(x - size + xOff, y, Z + zOff) != ModBlocks.seal_frame && - world.getBlock(x - size + xOff, y, Z + zOff) != ModBlocks.seal_controller) + for(int Z = z - size; Z <= z + size; Z++) { + if(world.getBlock(x - size + xOff, y, Z + zOff) != ModBlocks.seal_frame && world.getBlock(x - size + xOff, y, Z + zOff) != ModBlocks.seal_controller) valid = false; } - for(int Z = z - size; Z <= z + size; Z ++) { - if(world.getBlock(x + size + xOff, y, Z + zOff) != ModBlocks.seal_frame && - world.getBlock(x + size + xOff, y, Z + zOff) != ModBlocks.seal_controller) + for(int Z = z - size; Z <= z + size; Z++) { + if(world.getBlock(x + size + xOff, y, Z + zOff) != ModBlocks.seal_frame && world.getBlock(x + size + xOff, y, Z + zOff) != ModBlocks.seal_controller) valid = false; } - /*for(int X = x - size + 1; X <= x + size - 1; X++) { - for(int Z = z - size + 1; Z <= z + size - 1; Z++) { - //if(world.getBlock(X + size + xOff, y, Z + zOff) != ModBlocks.block_steel && - // world.getBlock(X + size + xOff, y, Z + zOff) != Blocks.air) - // valid = false; - world.setBlock(X + xOff, y, Z + zOff, ModBlocks.block_steel); - System.out.println(valid); - } - }*/ - + /* + * for(int X = x - size + 1; X <= x + size - 1; X++) { for(int Z = z + * - size + 1; Z <= z + size - 1; Z++) { //if(world.getBlock(X + + * size + xOff, y, Z + zOff) != ModBlocks.block_steel && // + * world.getBlock(X + size + xOff, y, Z + zOff) != Blocks.air) // + * valid = false; world.setBlock(X + xOff, y, Z + zOff, + * ModBlocks.block_steel); System.out.println(valid); } } + */ + if(valid) return size; } - + return 0; } - + public static void closeSeal(World world, int x, int y, int z, int size) { int xOff = 0; @@ -201,22 +152,22 @@ public class BlockSeal extends Block implements IBomb { xOff += size; if(world.getBlockMetadata(x, y, z) % 4 == 1) xOff -= size; - + for(int X = x - size + 1; X <= x + size - 1; X++) { for(int Z = z - size + 1; Z <= z + size - 1; Z++) { if(world.getBlock(X + xOff, y, Z + zOff) == Blocks.air && !world.isRemote) { world.setBlock(X + xOff, y, Z + zOff, ModBlocks.seal_hatch); TileEntity te = world.getTileEntity(X + xOff, y, Z + zOff); if(te != null && te instanceof TileEntityHatch) - ((TileEntityHatch)te).setControllerPos(x, y, z); - + ((TileEntityHatch) te).setControllerPos(x, y, z); + } } } } - + public static void openSeal(World world, int x, int y, int z, int size) { - + int xOff = 0; int zOff = 0; if(world.getBlockMetadata(x, y, z) % 4 == 2) @@ -227,7 +178,7 @@ public class BlockSeal extends Block implements IBomb { xOff += size; if(world.getBlockMetadata(x, y, z) % 4 == 1) xOff -= size; - + for(int X = x - size + 1; X <= x + size - 1; X++) { for(int Z = z - size + 1; Z <= z + size - 1; Z++) { if(world.getBlock(X + xOff, y, Z + zOff) == ModBlocks.seal_hatch && !world.isRemote) { @@ -236,9 +187,9 @@ public class BlockSeal extends Block implements IBomb { } } } - + public static boolean isSealClosed(World world, int x, int y, int z, int size) { - + int xOff = 0; int zOff = 0; if(world.getBlockMetadata(x, y, z) % 4 == 2) @@ -249,7 +200,7 @@ public class BlockSeal extends Block implements IBomb { xOff += size; if(world.getBlockMetadata(x, y, z) % 4 == 1) xOff -= size; - + for(int X = x - size + 1; X <= x + size - 1; X++) { for(int Z = z - size + 1; Z <= z + size - 1; Z++) { if(world.getBlock(X + xOff, y, Z + zOff) == ModBlocks.seal_hatch) { @@ -257,47 +208,53 @@ public class BlockSeal extends Block implements IBomb { } } } - + return false; } @Override - public void explode(World world, int x, int y, int z) { - int i = BlockSeal.getFrameSize(world, x, y, z); - - if(i != 0) - if(BlockSeal.isSealClosed(world, x, y, z, i)) - BlockSeal.openSeal(world, x, y, z, i); - else - BlockSeal.closeSeal(world, x, y, z, i); - + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + int i = BlockSeal.getFrameSize(world, x, y, z); + + if(i != 0) { + if(BlockSeal.isSealClosed(world, x, y, z, i)) { + BlockSeal.openSeal(world, x, y, z, i); + } else { + BlockSeal.closeSeal(world, x, y, z, i); + } + + return BombReturnCode.TRIGGERED; + } + + return BombReturnCode.ERROR_INCOMPATIBLE; + } + + return BombReturnCode.UNDEFINED; + } + + @Override + public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + if(world.isBlockIndirectlyGettingPowered(x, y, z)) { + int meta = world.getBlockMetadata(x, y, z); + if(meta < 4) { + world.setBlockMetadataWithNotify(x, y, z, meta + 4, 2); + + int i = BlockSeal.getFrameSize(world, x, y, z); + + if(i != 0) + if(BlockSeal.isSealClosed(world, x, y, z, i)) + BlockSeal.openSeal(world, x, y, z, i); + else + BlockSeal.closeSeal(world, x, y, z, i); + } + } else { + int meta = world.getBlockMetadata(x, y, z); + if(meta >= 4) { + world.setBlockMetadataWithNotify(x, y, z, meta % 4, 2); + } + } } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) - { - if (world.isBlockIndirectlyGettingPowered(x, y, z)) - { - int meta = world.getBlockMetadata(x, y, z); - if(meta < 4) { - world.setBlockMetadataWithNotify(x, y, z, meta + 4, 2); - - int i = BlockSeal.getFrameSize(world, x, y, z); - - if(i != 0) - if(BlockSeal.isSealClosed(world, x, y, z, i)) - BlockSeal.openSeal(world, x, y, z, i); - else - BlockSeal.closeSeal(world, x, y, z, i); - } - } - else - { - int meta = world.getBlockMetadata(x, y, z); - if(meta >= 4) { - world.setBlockMetadataWithNotify(x, y, z, meta % 4, 2); - } - } - } } diff --git a/src/main/java/com/hbm/blocks/machine/DummyBlockBlast.java b/src/main/java/com/hbm/blocks/machine/DummyBlockBlast.java index d086b5d15..34d1c78bd 100644 --- a/src/main/java/com/hbm/blocks/machine/DummyBlockBlast.java +++ b/src/main/java/com/hbm/blocks/machine/DummyBlockBlast.java @@ -109,20 +109,26 @@ public class DummyBlockBlast extends BlockContainer implements IDummy, IBomb { } @Override - public void explode(World world, int x, int y, int z) { + public BombReturnCode explode(World world, int x, int y, int z) { - TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TileEntityDummy) { - int a = ((TileEntityDummy)te).targetX; - int b = ((TileEntityDummy)te).targetY; - int c = ((TileEntityDummy)te).targetZ; + if(!world.isRemote) { - TileEntityBlastDoor entity = (TileEntityBlastDoor) world.getTileEntity(a, b, c); - if(entity != null && !entity.isLocked()) - { - entity.tryToggle(); + TileEntity te = world.getTileEntity(x, y, z); + if(te != null && te instanceof TileEntityDummy) { + int a = ((TileEntityDummy)te).targetX; + int b = ((TileEntityDummy)te).targetY; + int c = ((TileEntityDummy)te).targetZ; + + TileEntityBlastDoor entity = (TileEntityBlastDoor) world.getTileEntity(a, b, c); + if(entity != null && !entity.isLocked()) { + entity.tryToggle(); + return BombReturnCode.TRIGGERED; + } } + + return BombReturnCode.ERROR_INCOMPATIBLE; } + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/machine/DummyBlockVault.java b/src/main/java/com/hbm/blocks/machine/DummyBlockVault.java index e00d39cce..d8be87bb0 100644 --- a/src/main/java/com/hbm/blocks/machine/DummyBlockVault.java +++ b/src/main/java/com/hbm/blocks/machine/DummyBlockVault.java @@ -33,22 +33,21 @@ public class DummyBlockVault extends BlockContainer implements IDummy, IBomb { return new TileEntityDummy(); } - @Override - public void breakBlock(World world, int x, int y, int z, Block block, int i) - { - if(!safeBreak) { - TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TileEntityDummy) { - int a = ((TileEntityDummy)te).targetX; - int b = ((TileEntityDummy)te).targetY; - int c = ((TileEntityDummy)te).targetZ; - - if(!world.isRemote) - world.func_147480_a(a, b, c, true); - } - } - world.removeTileEntity(x, y, z); - } + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int i) { + if(!safeBreak) { + TileEntity te = world.getTileEntity(x, y, z); + if(te != null && te instanceof TileEntityDummy) { + int a = ((TileEntityDummy) te).targetX; + int b = ((TileEntityDummy) te).targetY; + int c = ((TileEntityDummy) te).targetZ; + + if(!world.isRemote) + world.func_147480_a(a, b, c, true); + } + } + world.removeTileEntity(x, y, z); + } @Override public int getRenderType() { @@ -64,80 +63,79 @@ public class DummyBlockVault extends BlockContainer implements IDummy, IBomb { public boolean renderAsNormalBlock() { return false; } - - @Override - public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { - return null; - } - @Override + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return null; + } + + @Override @SideOnly(Side.CLIENT) - public Item getItem(World world, int x, int y, int z) - { - return Item.getItemFromBlock(ModBlocks.vault_door); - } - + public Item getItem(World world, int x, int y, int z) { + return Item.getItemFromBlock(ModBlocks.vault_door); + } + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; } else if(player.getHeldItem() != null && (player.getHeldItem().getItem() instanceof ItemLock || player.getHeldItem().getItem() == ModItems.key_kit)) { return false; - - } else if(!player.isSneaking()) - { + + } else if(!player.isSneaking()) { TileEntity til = world.getTileEntity(x, y, z); if(til != null && til instanceof TileEntityDummy) { - int a = ((TileEntityDummy)til).targetX; - int b = ((TileEntityDummy)til).targetY; - int c = ((TileEntityDummy)til).targetZ; - + int a = ((TileEntityDummy) til).targetX; + int b = ((TileEntityDummy) til).targetY; + int c = ((TileEntityDummy) til).targetZ; + TileEntityVaultDoor entity = (TileEntityVaultDoor) world.getTileEntity(a, b, c); - if(entity != null) - { + if(entity != null) { if(entity.canAccess(player)) entity.tryToggle(); } } - + return true; } else { TileEntity te = world.getTileEntity(x, y, z); if(te != null && te instanceof TileEntityDummy) { - int a = ((TileEntityDummy)te).targetX; - int b = ((TileEntityDummy)te).targetY; - int c = ((TileEntityDummy)te).targetZ; - + int a = ((TileEntityDummy) te).targetX; + int b = ((TileEntityDummy) te).targetY; + int c = ((TileEntityDummy) te).targetZ; + TileEntityVaultDoor entity = (TileEntityVaultDoor) world.getTileEntity(a, b, c); - if(entity != null) - { + if(entity != null) { entity.type++; if(entity.type >= entity.maxTypes) entity.type = 0; } } - + return true; } } @Override - public void explode(World world, int x, int y, int z) { - - TileEntity te = world.getTileEntity(x, y, z); - if(te != null && te instanceof TileEntityDummy) { - int a = ((TileEntityDummy)te).targetX; - int b = ((TileEntityDummy)te).targetY; - int c = ((TileEntityDummy)te).targetZ; - - TileEntityVaultDoor entity = (TileEntityVaultDoor) world.getTileEntity(a, b, c); - if(entity != null && !entity.isLocked()) - { - entity.tryToggle(); + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntity te = world.getTileEntity(x, y, z); + if(te != null && te instanceof TileEntityDummy) { + int a = ((TileEntityDummy) te).targetX; + int b = ((TileEntityDummy) te).targetY; + int c = ((TileEntityDummy) te).targetZ; + + TileEntityVaultDoor entity = (TileEntityVaultDoor) world.getTileEntity(a, b, c); + if(entity != null && !entity.isLocked()) { + entity.tryToggle(); + return BombReturnCode.TRIGGERED; + } } + + return BombReturnCode.ERROR_INCOMPATIBLE; } - + + return BombReturnCode.UNDEFINED; } } diff --git a/src/main/java/com/hbm/blocks/machine/VaultDoor.java b/src/main/java/com/hbm/blocks/machine/VaultDoor.java index a529d7628..52372bcc7 100644 --- a/src/main/java/com/hbm/blocks/machine/VaultDoor.java +++ b/src/main/java/com/hbm/blocks/machine/VaultDoor.java @@ -25,212 +25,112 @@ public class VaultDoor extends BlockContainer implements IBomb, IMultiblock { public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileEntityVaultDoor(); } - + @Override - public int getRenderType(){ + public int getRenderType() { return -1; } - + @Override public boolean isOpaqueCube() { return false; } - + @Override public boolean renderAsNormalBlock() { return false; } @Override - public void explode(World world, int x, int y, int z) { - TileEntityVaultDoor te = (TileEntityVaultDoor) world.getTileEntity(x, y, z); + public BombReturnCode explode(World world, int x, int y, int z) { + + if(!world.isRemote) { + TileEntityVaultDoor te = (TileEntityVaultDoor) world.getTileEntity(x, y, z); + + if(!te.isLocked()) { + te.tryToggle(); + return BombReturnCode.TRIGGERED; + } + + return BombReturnCode.ERROR_INCOMPATIBLE; + } - if(!te.isLocked()) - te.tryToggle(); + return BombReturnCode.UNDEFINED; } - + @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { - + TileEntityVaultDoor te = (TileEntityVaultDoor) world.getTileEntity(x, y, z); - + int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - - if(i == 0) - { + + if(i == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); - - //frame - if(!(te.placeDummy(x + 1, y, z) && - te.placeDummy(x + 2, y, z) && - te.placeDummy(x + 2, y + 1, z) && - te.placeDummy(x + 2, y + 2, z) && - te.placeDummy(x + 2, y + 3, z) && - te.placeDummy(x + 2, y + 4, z) && - te.placeDummy(x + 1, y + 4, z) && - te.placeDummy(x, y + 4, z) && - te.placeDummy(x - 1, y + 4, z) && - te.placeDummy(x - 2, y + 4, z) && - te.placeDummy(x - 2, y + 3, z) && - te.placeDummy(x - 2, y + 2, z) && - te.placeDummy(x - 2, y + 1, z) && - te.placeDummy(x - 2, y, z) && - te.placeDummy(x - 1, y, z) && - //cog - te.placeDummy(x - 1, y + 1, z) && - te.placeDummy(x - 1, y + 2, z) && - te.placeDummy(x - 1, y + 3, z) && - te.placeDummy(x, y + 1, z) && - te.placeDummy(x, y + 2, z) && - te.placeDummy(x, y + 3, z) && - te.placeDummy(x + 1, y + 1, z) && - te.placeDummy(x + 1, y + 2, z) && - te.placeDummy(x + 1, y + 3, z) && - //teeth - te.placeDummy(x + 2, y, z + 1) && - te.placeDummy(x + 1, y, z + 1) && - te.placeDummy(x, y, z + 1) && - te.placeDummy(x - 1, y, z + 1) && - te.placeDummy(x - 2, y, z + 1))) { - - world.func_147480_a(x, y, z, true); + + // frame + if(!(te.placeDummy(x + 1, y, z) && te.placeDummy(x + 2, y, z) && te.placeDummy(x + 2, y + 1, z) && te.placeDummy(x + 2, y + 2, z) && te.placeDummy(x + 2, y + 3, z) && te.placeDummy(x + 2, y + 4, z) && te.placeDummy(x + 1, y + 4, z) && te.placeDummy(x, y + 4, z) && te.placeDummy(x - 1, y + 4, z) && te.placeDummy(x - 2, y + 4, z) && te.placeDummy(x - 2, y + 3, z) && te.placeDummy(x - 2, y + 2, z) && te.placeDummy(x - 2, y + 1, z) && te.placeDummy(x - 2, y, z) && te.placeDummy(x - 1, y, z) && + // cog + te.placeDummy(x - 1, y + 1, z) && te.placeDummy(x - 1, y + 2, z) && te.placeDummy(x - 1, y + 3, z) && te.placeDummy(x, y + 1, z) && te.placeDummy(x, y + 2, z) && te.placeDummy(x, y + 3, z) && te.placeDummy(x + 1, y + 1, z) && te.placeDummy(x + 1, y + 2, z) && te.placeDummy(x + 1, y + 3, z) && + // teeth + te.placeDummy(x + 2, y, z + 1) && te.placeDummy(x + 1, y, z + 1) && te.placeDummy(x, y, z + 1) && te.placeDummy(x - 1, y, z + 1) && te.placeDummy(x - 2, y, z + 1))) { + + world.func_147480_a(x, y, z, true); } } - if(i == 1) - { + if(i == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); - - //frame - if(!(te.placeDummy(x, y, z + 1) && - te.placeDummy(x, y, z + 2) && - te.placeDummy(x, y + 1, z + 2) && - te.placeDummy(x, y + 2, z + 2) && - te.placeDummy(x, y + 3, z + 2) && - te.placeDummy(x, y + 4, z + 2) && - te.placeDummy(x, y + 4, z + 1) && - te.placeDummy(x, y + 4, z) && - te.placeDummy(x, y + 4, z - 1) && - te.placeDummy(x, y + 4, z - 2) && - te.placeDummy(x, y + 3, z - 2) && - te.placeDummy(x, y + 2, z - 2) && - te.placeDummy(x, y + 1, z - 2) && - te.placeDummy(x, y, z - 2) && - te.placeDummy(x, y, z - 1) && - //cog - te.placeDummy(x, y + 1, z - 1) && - te.placeDummy(x, y + 2, z - 1) && - te.placeDummy(x, y + 3, z - 1) && - te.placeDummy(x, y + 1, z) && - te.placeDummy(x, y + 2, z) && - te.placeDummy(x, y + 3, z) && - te.placeDummy(x, y + 1, z + 1) && - te.placeDummy(x, y + 2, z + 1) && - te.placeDummy(x, y + 3, z + 1) && - //teeth - te.placeDummy(x - 1, y, z + 2) && - te.placeDummy(x - 1, y, z + 1) && - te.placeDummy(x - 1, y, z) && - te.placeDummy(x - 1, y, z - 1) && - te.placeDummy(x - 1, y, z - 2))) { - - world.func_147480_a(x, y, z, true); + + // frame + if(!(te.placeDummy(x, y, z + 1) && te.placeDummy(x, y, z + 2) && te.placeDummy(x, y + 1, z + 2) && te.placeDummy(x, y + 2, z + 2) && te.placeDummy(x, y + 3, z + 2) && te.placeDummy(x, y + 4, z + 2) && te.placeDummy(x, y + 4, z + 1) && te.placeDummy(x, y + 4, z) && te.placeDummy(x, y + 4, z - 1) && te.placeDummy(x, y + 4, z - 2) && te.placeDummy(x, y + 3, z - 2) && te.placeDummy(x, y + 2, z - 2) && te.placeDummy(x, y + 1, z - 2) && te.placeDummy(x, y, z - 2) && te.placeDummy(x, y, z - 1) && + // cog + te.placeDummy(x, y + 1, z - 1) && te.placeDummy(x, y + 2, z - 1) && te.placeDummy(x, y + 3, z - 1) && te.placeDummy(x, y + 1, z) && te.placeDummy(x, y + 2, z) && te.placeDummy(x, y + 3, z) && te.placeDummy(x, y + 1, z + 1) && te.placeDummy(x, y + 2, z + 1) && te.placeDummy(x, y + 3, z + 1) && + // teeth + te.placeDummy(x - 1, y, z + 2) && te.placeDummy(x - 1, y, z + 1) && te.placeDummy(x - 1, y, z) && te.placeDummy(x - 1, y, z - 1) && te.placeDummy(x - 1, y, z - 2))) { + + world.func_147480_a(x, y, z, true); } } - if(i == 2) - { + if(i == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); - - //frame - if(!(te.placeDummy(x + 1, y, z) && - te.placeDummy(x + 2, y, z) && - te.placeDummy(x + 2, y + 1, z) && - te.placeDummy(x + 2, y + 2, z) && - te.placeDummy(x + 2, y + 3, z) && - te.placeDummy(x + 2, y + 4, z) && - te.placeDummy(x + 1, y + 4, z) && - te.placeDummy(x, y + 4, z) && - te.placeDummy(x - 1, y + 4, z) && - te.placeDummy(x - 2, y + 4, z) && - te.placeDummy(x - 2, y + 3, z) && - te.placeDummy(x - 2, y + 2, z) && - te.placeDummy(x - 2, y + 1, z) && - te.placeDummy(x - 2, y, z) && - te.placeDummy(x - 1, y, z) && - //cog - te.placeDummy(x - 1, y + 1, z) && - te.placeDummy(x - 1, y + 2, z) && - te.placeDummy(x - 1, y + 3, z) && - te.placeDummy(x, y + 1, z) && - te.placeDummy(x, y + 2, z) && - te.placeDummy(x, y + 3, z) && - te.placeDummy(x + 1, y + 1, z) && - te.placeDummy(x + 1, y + 2, z) && - te.placeDummy(x + 1, y + 3, z) && - //teeth - te.placeDummy(x + 2, y, z - 1) && - te.placeDummy(x + 1, y, z - 1) && - te.placeDummy(x, y, z - 1) && - te.placeDummy(x - 1, y, z - 1) && - te.placeDummy(x - 2, y, z - 1))) { - - world.func_147480_a(x, y, z, true); + + // frame + if(!(te.placeDummy(x + 1, y, z) && te.placeDummy(x + 2, y, z) && te.placeDummy(x + 2, y + 1, z) && te.placeDummy(x + 2, y + 2, z) && te.placeDummy(x + 2, y + 3, z) && te.placeDummy(x + 2, y + 4, z) && te.placeDummy(x + 1, y + 4, z) && te.placeDummy(x, y + 4, z) && te.placeDummy(x - 1, y + 4, z) && te.placeDummy(x - 2, y + 4, z) && te.placeDummy(x - 2, y + 3, z) && te.placeDummy(x - 2, y + 2, z) && te.placeDummy(x - 2, y + 1, z) && te.placeDummy(x - 2, y, z) && te.placeDummy(x - 1, y, z) && + // cog + te.placeDummy(x - 1, y + 1, z) && te.placeDummy(x - 1, y + 2, z) && te.placeDummy(x - 1, y + 3, z) && te.placeDummy(x, y + 1, z) && te.placeDummy(x, y + 2, z) && te.placeDummy(x, y + 3, z) && te.placeDummy(x + 1, y + 1, z) && te.placeDummy(x + 1, y + 2, z) && te.placeDummy(x + 1, y + 3, z) && + // teeth + te.placeDummy(x + 2, y, z - 1) && te.placeDummy(x + 1, y, z - 1) && te.placeDummy(x, y, z - 1) && te.placeDummy(x - 1, y, z - 1) && te.placeDummy(x - 2, y, z - 1))) { + + world.func_147480_a(x, y, z, true); } } - if(i == 3) - { + if(i == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); - - //frame - if(!(te.placeDummy(x, y, z + 1) && - te.placeDummy(x, y, z + 2) && - te.placeDummy(x, y + 1, z + 2) && - te.placeDummy(x, y + 2, z + 2) && - te.placeDummy(x, y + 3, z + 2) && - te.placeDummy(x, y + 4, z + 2) && - te.placeDummy(x, y + 4, z + 1) && - te.placeDummy(x, y + 4, z) && - te.placeDummy(x, y + 4, z - 1) && - te.placeDummy(x, y + 4, z - 2) && - te.placeDummy(x, y + 3, z - 2) && - te.placeDummy(x, y + 2, z - 2) && - te.placeDummy(x, y + 1, z - 2) && - te.placeDummy(x, y, z - 2) && - te.placeDummy(x, y, z - 1) && - //cog - te.placeDummy(x, y + 1, z - 1) && - te.placeDummy(x, y + 2, z - 1) && - te.placeDummy(x, y + 3, z - 1) && - te.placeDummy(x, y + 1, z) && - te.placeDummy(x, y + 2, z) && - te.placeDummy(x, y + 3, z) && - te.placeDummy(x, y + 1, z + 1) && - te.placeDummy(x, y + 2, z + 1) && - te.placeDummy(x, y + 3, z + 1) && - //teeth - te.placeDummy(x + 1, y, z + 2) && - te.placeDummy(x + 1, y, z + 1) && - te.placeDummy(x + 1, y, z) && - te.placeDummy(x + 1, y, z - 1) && - te.placeDummy(x + 1, y, z - 2))) { - - world.func_147480_a(x, y, z, true); + + // frame + if(!(te.placeDummy(x, y, z + 1) && te.placeDummy(x, y, z + 2) && te.placeDummy(x, y + 1, z + 2) && te.placeDummy(x, y + 2, z + 2) && te.placeDummy(x, y + 3, z + 2) && te.placeDummy(x, y + 4, z + 2) && te.placeDummy(x, y + 4, z + 1) && te.placeDummy(x, y + 4, z) && te.placeDummy(x, y + 4, z - 1) && te.placeDummy(x, y + 4, z - 2) && te.placeDummy(x, y + 3, z - 2) && te.placeDummy(x, y + 2, z - 2) && te.placeDummy(x, y + 1, z - 2) && te.placeDummy(x, y, z - 2) && te.placeDummy(x, y, z - 1) && + // cog + te.placeDummy(x, y + 1, z - 1) && te.placeDummy(x, y + 2, z - 1) && te.placeDummy(x, y + 3, z - 1) && te.placeDummy(x, y + 1, z) && te.placeDummy(x, y + 2, z) && te.placeDummy(x, y + 3, z) && te.placeDummy(x, y + 1, z + 1) && te.placeDummy(x, y + 2, z + 1) && te.placeDummy(x, y + 3, z + 1) && + // teeth + te.placeDummy(x + 1, y, z + 2) && te.placeDummy(x + 1, y, z + 1) && te.placeDummy(x + 1, y, z) && te.placeDummy(x + 1, y, z - 1) && te.placeDummy(x + 1, y, z - 2))) { + + world.func_147480_a(x, y, z, true); } } } - + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { - if(world.isRemote) - { + if(world.isRemote) { return true; } else if(player.getHeldItem() != null && (player.getHeldItem().getItem() instanceof ItemLock || player.getHeldItem().getItem() == ModItems.key_kit)) { return false; - - } if(!player.isSneaking()) { - + + } + if(!player.isSneaking()) { + TileEntityVaultDoor entity = (TileEntityVaultDoor) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { if(entity.isLocked()) { if(entity.canAccess(player)) entity.tryToggle(); @@ -238,18 +138,17 @@ public class VaultDoor extends BlockContainer implements IBomb, IMultiblock { entity.tryToggle(); } } - + return true; } else { - + TileEntityVaultDoor entity = (TileEntityVaultDoor) world.getTileEntity(x, y, z); - if(entity != null) - { + if(entity != null) { entity.type++; if(entity.type >= entity.maxTypes) entity.type = 0; } - + return true; } } diff --git a/src/main/java/com/hbm/blocks/network/PylonLarge.java b/src/main/java/com/hbm/blocks/network/PylonLarge.java index e0457f924..e00b06b8c 100644 --- a/src/main/java/com/hbm/blocks/network/PylonLarge.java +++ b/src/main/java/com/hbm/blocks/network/PylonLarge.java @@ -11,7 +11,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; public class PylonLarge extends BlockDummyable implements ITooltipProvider { @@ -36,7 +38,7 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider { @Override public int[] getDimensions() { - return new int[] {0, 0, 1, 1, 1, 1}; + return new int[] {13, 0, 1, 1, 1, 1}; } @Override @@ -46,6 +48,24 @@ public class PylonLarge extends BlockDummyable implements ITooltipProvider { @Override protected int getMetaForCore(World world, int x, int y, int z, EntityPlayer player, int original) { - return original; + + int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 180.0F + 0.5D) & 3; + + ForgeDirection dir = ForgeDirection.NORTH; + + if(i == 0) { + dir = ForgeDirection.getOrientation(2); + } + if(i == 1) { + dir = ForgeDirection.getOrientation(5); + } + if(i == 2) { + dir = ForgeDirection.getOrientation(3); + } + if(i == 3) { + dir = ForgeDirection.getOrientation(4); + } + + return dir.ordinal() + offset; } } diff --git a/src/main/java/com/hbm/interfaces/IBomb.java b/src/main/java/com/hbm/interfaces/IBomb.java index ca2232594..bb0c4c4fb 100644 --- a/src/main/java/com/hbm/interfaces/IBomb.java +++ b/src/main/java/com/hbm/interfaces/IBomb.java @@ -10,5 +10,41 @@ public interface IBomb { //Months later I found this joke again //I'm not even sorry - void explode(World world, int x, int y, int z); + /** + * Triggers the bomb and generates a return code. Since most bombs have a serverside inventory, the return code + * should only be processed serverside, what's returned on the client should be ignored. + * Ofen invoked by onNeighborBlockChanged, so in any case make sure to check for world-remoteness. + * @param world + * @param x + * @param y + * @param z + * @return + */ + public BombReturnCode explode(World world, int x, int y, int z); + + public static enum BombReturnCode { + UNDEFINED(false, ""), //non-null type for passing to clients that don't process the return code + DETONATED(true, "bomb.detonated"), //success for blowing up bombs + TRIGGERED(true, "bomb.triggered"), //success for triggering other things + LAUNCHED(true, "bomb.launched"), //success for launching missiles + ERROR_MISSING_COMPONENT(false, "bomb.missingComponent"), //error for bomb parts missing + ERROR_INCOMPATIBLE(false, "bomb.incompatible"), //error for target being incompatible (but still implements IBomb for some reason), like locked blast doors + ERROR_NO_BOMB(false, "bomb.nobomb"); //not to be used by the bombs themselves, this is the generic error when trying to trigger no-bomb blocks + + private String unloc; + private boolean success; + + private BombReturnCode(boolean success, String unloc) { + this.unloc = unloc; + this.success = success; + } + + public String getUnlocalizedMessage() { + return this.unloc; + } + + public boolean wasSuccessful() { + return this.success; + } + } } diff --git a/src/main/java/com/hbm/inventory/SlotSmelting.java b/src/main/java/com/hbm/inventory/SlotSmelting.java new file mode 100644 index 000000000..89e0bac92 --- /dev/null +++ b/src/main/java/com/hbm/inventory/SlotSmelting.java @@ -0,0 +1,89 @@ +package com.hbm.inventory; + +import cpw.mods.fml.common.FMLCommonHandler; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.MathHelper; + +public class SlotSmelting extends Slot { + + private EntityPlayer thePlayer; + private int itemCountBuffer; + + public SlotSmelting(EntityPlayer player, IInventory inv, int id, int x, int y) { + super(inv, id, x, y); + this.thePlayer = player; + } + + public boolean isItemValid(ItemStack stack) { + return false; + } + + public ItemStack decrStackSize(int amount) { + + if(this.getHasStack()) { + this.itemCountBuffer += Math.min(amount, this.getStack().stackSize); + } + + return super.decrStackSize(amount); + } + + public void onPickupFromSlot(EntityPlayer player, ItemStack stack) { + this.onCrafting(stack); + super.onPickupFromSlot(player, stack); + } + + protected void onCrafting(ItemStack stack, int amount) { + this.itemCountBuffer += amount; + this.onCrafting(stack); + } + + protected void onCrafting(ItemStack stack) { + + stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.itemCountBuffer); + + if(!this.thePlayer.worldObj.isRemote) { + + int buffer = this.itemCountBuffer; + float exp = FurnaceRecipes.smelting().func_151398_b(stack); + int remainingExp; + + if(exp == 0.0F) { + buffer = 0; + + } else if(exp < 1.0F) { + remainingExp = MathHelper.floor_float((float) buffer * exp); + + if(remainingExp < MathHelper.ceiling_float_int((float) buffer * exp) && (float) Math.random() < (float) buffer * exp - (float) remainingExp) { + ++remainingExp; + } + + buffer = remainingExp; + } + + while(buffer > 0) { + remainingExp = EntityXPOrb.getXPSplit(buffer); + buffer -= remainingExp; + this.thePlayer.worldObj.spawnEntityInWorld(new EntityXPOrb(this.thePlayer.worldObj, this.thePlayer.posX, this.thePlayer.posY + 0.5D, this.thePlayer.posZ + 0.5D, remainingExp)); + } + } + + this.itemCountBuffer = 0; + + FMLCommonHandler.instance().firePlayerSmeltedEvent(thePlayer, stack); + + if(stack.getItem() == Items.iron_ingot) { + this.thePlayer.addStat(AchievementList.acquireIron, 1); + } + + if(stack.getItem() == Items.cooked_fished) { + this.thePlayer.addStat(AchievementList.cookFish, 1); + } + } +} diff --git a/src/main/java/com/hbm/inventory/container/ContainerDiFurnace.java b/src/main/java/com/hbm/inventory/container/ContainerDiFurnace.java index bac28c2db..3ea75ee56 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerDiFurnace.java +++ b/src/main/java/com/hbm/inventory/container/ContainerDiFurnace.java @@ -15,12 +15,10 @@ public class ContainerDiFurnace extends Container { private TileEntityDiFurnace diFurnace; private int dualCookTime; private int dualPower; - private int lastItemBurnTime; public ContainerDiFurnace(InventoryPlayer invPlayer, TileEntityDiFurnace tedf) { dualCookTime = 0; dualPower = 0; - lastItemBurnTime = 0; diFurnace = tedf; diff --git a/src/main/java/com/hbm/inventory/container/ContainerElectricFurnace.java b/src/main/java/com/hbm/inventory/container/ContainerElectricFurnace.java index 640484524..3bcca41e5 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerElectricFurnace.java +++ b/src/main/java/com/hbm/inventory/container/ContainerElectricFurnace.java @@ -1,6 +1,6 @@ package com.hbm.inventory.container; -import com.hbm.inventory.SlotMachineOutput; +import com.hbm.inventory.SlotSmelting; import com.hbm.tileentity.machine.TileEntityMachineElectricFurnace; import net.minecraft.entity.player.EntityPlayer; @@ -11,71 +11,62 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerElectricFurnace extends Container { - + private TileEntityMachineElectricFurnace diFurnace; - + public ContainerElectricFurnace(InventoryPlayer invPlayer, TileEntityMachineElectricFurnace tedf) { - + diFurnace = tedf; - + this.addSlotToContainer(new Slot(tedf, 0, 56, 53)); this.addSlotToContainer(new Slot(tedf, 1, 56, 17)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 2, 116, 35)); - - for(int i = 0; i < 3; i++) - { - for(int j = 0; j < 9; j++) - { + this.addSlotToContainer(new SlotSmelting(invPlayer.player, tedf, 2, 116, 35)); + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } - - for(int i = 0; i < 9; i++) - { + + for(int i = 0; i < 9; i++) { this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); } } - + @Override public void addCraftingToCrafters(ICrafting crafting) { super.addCraftingToCrafters(crafting); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) - { + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) { ItemStack var3 = null; Slot var4 = (Slot) this.inventorySlots.get(par2); - - if (var4 != null && var4.getHasStack()) - { + + if(var4 != null && var4.getHasStack()) { ItemStack var5 = var4.getStack(); var3 = var5.copy(); - - if (par2 <= 2) { - if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true)) - { + + if(par2 <= 2) { + if(!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true)) { return null; } + + var4.onSlotChange(var5, var3); + } else if(!this.mergeItemStack(var5, 1, 2, false)) { + if(!this.mergeItemStack(var5, 0, 1, false)) + return null; } - else if (!this.mergeItemStack(var5, 1, 2, false)) - { - if (!this.mergeItemStack(var5, 0, 1, false)) - return null; - } - - if (var5.stackSize == 0) - { + + if(var5.stackSize == 0) { var4.putStack((ItemStack) null); - } - else - { + } else { var4.onSlotChanged(); } } - + return var3; - } + } @Override public boolean canInteractWith(EntityPlayer player) { diff --git a/src/main/java/com/hbm/inventory/container/ContainerMachineArcFurnace.java b/src/main/java/com/hbm/inventory/container/ContainerMachineArcFurnace.java index ce4b36d92..746bef698 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerMachineArcFurnace.java +++ b/src/main/java/com/hbm/inventory/container/ContainerMachineArcFurnace.java @@ -1,6 +1,6 @@ package com.hbm.inventory.container; -import com.hbm.inventory.SlotMachineOutput; +import com.hbm.inventory.SlotSmelting; import com.hbm.tileentity.machine.TileEntityMachineArcFurnace; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -10,74 +10,66 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; public class ContainerMachineArcFurnace extends Container { - + private TileEntityMachineArcFurnace diFurnace; - + public ContainerMachineArcFurnace(InventoryPlayer invPlayer, TileEntityMachineArcFurnace tedf) { - + diFurnace = tedf; - + this.addSlotToContainer(new Slot(tedf, 0, 56, 17)); - this.addSlotToContainer(new SlotMachineOutput(tedf, 1, 116, 35)); + this.addSlotToContainer(new SlotSmelting(invPlayer.player, tedf, 1, 116, 35)); this.addSlotToContainer(new Slot(tedf, 2, 38, 53)); this.addSlotToContainer(new Slot(tedf, 3, 56, 53)); this.addSlotToContainer(new Slot(tedf, 4, 74, 53)); this.addSlotToContainer(new Slot(tedf, 5, 8, 53)); - - for(int i = 0; i < 3; i++) - { - for(int j = 0; j < 9; j++) - { + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } - - for(int i = 0; i < 9; i++) - { + + for(int i = 0; i < 9; i++) { this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142)); } } - + @Override public void addCraftingToCrafters(ICrafting crafting) { super.addCraftingToCrafters(crafting); } - + @Override - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) - { + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) { ItemStack var3 = null; Slot var4 = (Slot) this.inventorySlots.get(par2); - - if (var4 != null && var4.getHasStack()) - { + + if(var4 != null && var4.getHasStack()) { ItemStack var5 = var4.getStack(); var3 = var5.copy(); - - if (par2 <= 5) { - if (!this.mergeItemStack(var5, 6, this.inventorySlots.size(), true)) - { + + if(par2 <= 5) { + if(!this.mergeItemStack(var5, 6, this.inventorySlots.size(), true)) { return null; } + + var4.onSlotChange(var5, var3); + + } else if(!this.mergeItemStack(var5, 0, 1, false)) { + if(!this.mergeItemStack(var5, 2, 6, false)) + return null; } - else if (!this.mergeItemStack(var5, 0, 1, false)) - { - if (!this.mergeItemStack(var5, 2, 6, false)) - return null; - } - - if (var5.stackSize == 0) - { + + if(var5.stackSize == 0) { var4.putStack((ItemStack) null); - } - else - { + } else { var4.onSlotChanged(); } } - + return var3; - } + } @Override public boolean canInteractWith(EntityPlayer player) { diff --git a/src/main/java/com/hbm/items/tool/ItemDetonator.java b/src/main/java/com/hbm/items/tool/ItemDetonator.java index cb256870a..c6e5530ca 100644 --- a/src/main/java/com/hbm/items/tool/ItemDetonator.java +++ b/src/main/java/com/hbm/items/tool/ItemDetonator.java @@ -6,93 +6,98 @@ import org.apache.logging.log4j.Level; import com.hbm.config.GeneralConfig; import com.hbm.interfaces.IBomb; +import com.hbm.interfaces.IBomb.BombReturnCode; import com.hbm.main.MainRegistry; +import com.hbm.util.ChatBuilder; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; public class ItemDetonator extends Item { @Override - public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) - { + public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { list.add("Shift right-click to set position,"); list.add("right-click to detonate!"); - if(itemstack.getTagCompound() == null) - { - list.add("No position set!"); + if(itemstack.getTagCompound() == null) { + list.add(EnumChatFormatting.RED + "No position set!"); } else { - list.add("Set pos to " + itemstack.stackTagCompound.getInteger("x") + ", " + itemstack.stackTagCompound.getInteger("y") + ", " + itemstack.stackTagCompound.getInteger("z")); + list.add(EnumChatFormatting.YELLOW + "Linked to " + itemstack.stackTagCompound.getInteger("x") + ", " + itemstack.stackTagCompound.getInteger("y") + ", " + itemstack.stackTagCompound.getInteger("z")); } } - + @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) - { - if(stack.stackTagCompound == null) - { + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { + if(stack.stackTagCompound == null) { stack.stackTagCompound = new NBTTagCompound(); } - - if(player.isSneaking()) - { + + if(player.isSneaking()) { stack.stackTagCompound.setInteger("x", x); stack.stackTagCompound.setInteger("y", y); stack.stackTagCompound.setInteger("z", z); - - if(world.isRemote) - { - player.addChatMessage(new ChatComponentText("Position set!")); + + if(!world.isRemote) { + player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA) + .nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA) + .next("] ").color(EnumChatFormatting.DARK_AQUA) + .next("Position set!").color(EnumChatFormatting.GREEN).flush()); } - - world.playSoundAtEntity(player, "hbm:item.techBoop", 2.0F, 1.0F); - + + world.playSoundAtEntity(player, "hbm:item.techBoop", 2.0F, 1.0F); + return true; } - + return false; - } + } @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - if(stack.stackTagCompound == null) - { - if(world.isRemote) - player.addChatMessage(new ChatComponentText("Error: Position not set.")); + if(stack.stackTagCompound == null) { + if(!world.isRemote) { + player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA) + .nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA) + .next("] ").color(EnumChatFormatting.DARK_AQUA) + .next("No position set!").color(EnumChatFormatting.RED).flush()); + } } else { - int x = stack.stackTagCompound.getInteger("x"); - int y = stack.stackTagCompound.getInteger("y"); - int z = stack.stackTagCompound.getInteger("z"); - - if(world.getBlock(x, y, z) instanceof IBomb) - { - world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F); - if(!world.isRemote) - { - ((IBomb)world.getBlock(x, y, z)).explode(world, x, y, z); + int x = stack.stackTagCompound.getInteger("x"); + int y = stack.stackTagCompound.getInteger("y"); + int z = stack.stackTagCompound.getInteger("z"); - if(GeneralConfig.enableExtendedLogging) - MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!"); + if(world.getBlock(x, y, z) instanceof IBomb) { + world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F); + if(!world.isRemote) { + BombReturnCode ret = ((IBomb) world.getBlock(x, y, z)).explode(world, x, y, z); + + if(GeneralConfig.enableExtendedLogging) + MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!"); + + player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA) + .nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA) + .next("] ").color(EnumChatFormatting.DARK_AQUA) + .nextTranslation(ret.getUnlocalizedMessage()).color(ret.wasSuccessful() ? EnumChatFormatting.YELLOW : EnumChatFormatting.RED).flush()); } - if(world.isRemote) - { - player.addChatMessage(new ChatComponentText("Detonated!")); + + } else { + if(!world.isRemote) { + player.addChatMessage(ChatBuilder.start("[").color(EnumChatFormatting.DARK_AQUA) + .nextTranslation(this.getUnlocalizedName() + ".name").color(EnumChatFormatting.DARK_AQUA) + .next("] ").color(EnumChatFormatting.DARK_AQUA) + .nextTranslation(BombReturnCode.ERROR_NO_BOMB.getUnlocalizedMessage()).color(EnumChatFormatting.RED).flush()); } - } else { - if(world.isRemote) - { - player.addChatMessage(new ChatComponentText("Error: Target incompatible or too far away.")); - } - } + } } - + return stack; - + } } diff --git a/src/main/java/com/hbm/items/tool/ItemWiring.java b/src/main/java/com/hbm/items/tool/ItemWiring.java index 367dadc51..73f00a739 100644 --- a/src/main/java/com/hbm/items/tool/ItemWiring.java +++ b/src/main/java/com/hbm/items/tool/ItemWiring.java @@ -2,8 +2,10 @@ package com.hbm.items.tool; import java.util.List; +import com.hbm.blocks.BlockDummyable; import com.hbm.tileentity.network.TileEntityPylonBase; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -16,13 +18,26 @@ public class ItemWiring extends Item { @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { - - if (!player.isSneaking()) { + + if(!player.isSneaking()) { + + Block b = world.getBlock(x, y, z); + + if(b instanceof BlockDummyable) { + int[] core = ((BlockDummyable)b).findCore(world, x, y, z); + + if(core != null) { + x = core[0]; + y = core[1]; + z = core[2]; + } + } + TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityPylonBase) { + if(te != null && te instanceof TileEntityPylonBase) { - if (stack.stackTagCompound == null) { + if(stack.stackTagCompound == null) { stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("x", x); @@ -30,33 +45,33 @@ public class ItemWiring extends Item { stack.stackTagCompound.setInteger("z", z); if(!world.isRemote) { - player.addChatMessage(new ChatComponentText( "Wire start")); + player.addChatMessage(new ChatComponentText("Wire start")); } } else if(!world.isRemote) { - + int x1 = stack.stackTagCompound.getInteger("x"); int y1 = stack.stackTagCompound.getInteger("y"); int z1 = stack.stackTagCompound.getInteger("z"); - if (world.getTileEntity(x1, y1, z1) instanceof TileEntityPylonBase) { + if(world.getTileEntity(x1, y1, z1) instanceof TileEntityPylonBase) { TileEntityPylonBase first = (TileEntityPylonBase) world.getTileEntity(x1, y1, z1); TileEntityPylonBase second = ((TileEntityPylonBase) te); - + if(TileEntityPylonBase.canConnect(first, second)) { - + first.addConnection(x, y, z); second.addConnection(x1, y1, z1); player.addChatMessage(new ChatComponentText("Wire end")); - + } else { player.addChatMessage(new ChatComponentText("Wire error")); } stack.stackTagCompound = null; - + } else { - + if(!world.isRemote) { player.addChatMessage(new ChatComponentText("Wire error")); } @@ -74,7 +89,7 @@ public class ItemWiring extends Item { @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) { - if (itemstack.stackTagCompound != null) { + if(itemstack.stackTagCompound != null) { list.add("Wire start x: " + itemstack.stackTagCompound.getInteger("x")); list.add("Wire start y: " + itemstack.stackTagCompound.getInteger("y")); list.add("Wire start z: " + itemstack.stackTagCompound.getInteger("z")); diff --git a/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java b/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java index 8d3916a5a..2dda796c5 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java +++ b/src/main/java/com/hbm/render/tileentity/RenderPylonBase.java @@ -72,6 +72,14 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { } } + /** + * The closest we have to a does-all solution. It will figure out if it needs to draw multiple lines, + * iterate through all the mounting points, try to find the matching mounting points and then draw the lines. + * @param pyl + * @param x + * @param y + * @param z + */ public void renderLinesGeneric(TileEntityPylonBase pyl, double x, double y, double z) { for(int i = 0; i < pyl.connected.size(); i++) { @@ -90,7 +98,25 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { for(int line = 0; line < lineCount; line++) { Vec3 first = m1[line % m1.length]; - Vec3 second = m2[line % m2.length]; + int secondIndex = line % m2.length; + + /* + * hacky hacky hack + * this will shift the mount point order by 2 to prevent wires from crossing + * when meta 12 and 15 pylons are connected. this isn't a great solution + * and there's still ways to cross the wires in an ugly way but for now + * it should be enough. + */ + if(lineCount == 4 && ( + (pyl.getBlockMetadata() - 10 == 5 && pylon.getBlockMetadata() - 10 == 2) || + (pyl.getBlockMetadata() - 10 == 2 && pylon.getBlockMetadata() - 10 == 5))) { + + secondIndex += 2; + secondIndex %= m2.length; + } + + Vec3 second = m2[secondIndex]; + double sX = second.xCoord + pylon.xCoord - pyl.xCoord; double sY = second.yCoord + pylon.yCoord - pyl.yCoord; double sZ = second.zCoord + pylon.zCoord - pyl.zCoord; @@ -107,6 +133,23 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { } } + /** + * Renders half a line + * First coords: the relative render position + * Second coords: the pylon's mounting point + * Third coords: the midway point exactly between the mounting points. The "hang" doesn't need to be accounted for, it's calculated in here. + * @param world + * @param pyl + * @param x + * @param y + * @param z + * @param x0 + * @param y0 + * @param z0 + * @param x1 + * @param y1 + * @param z1 + */ public void renderLine(World world, TileEntityPylonBase pyl, double x, double y, double z, double x0, double y0, double z0, double x1, double y1, double z1) { GL11.glPushMatrix(); @@ -142,6 +185,17 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } + /** + * Draws a single segment from the first to the second 3D coordinate. + * Not fantastic but it looks good enough. + * Possible enhancement: remove the draw calls and put those around the drawLineSegment calls for better-er performance + * @param x + * @param y + * @param z + * @param a + * @param b + * @param c + */ public void drawLineSegment(double x, double y, double z, double a, double b, double c) { double girth = 0.03125D; @@ -151,7 +205,7 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { GL11.glDisable(GL11.GL_CULL_FACE); Tessellator tessellator = Tessellator.instance; tessellator.startDrawing(5); - tessellator.setColorOpaque_I(0xBB3311); + tessellator.setColorOpaque_I(LINE_COLOR); tessellator.addVertex(x, y + girth, z); tessellator.addVertex(x, y - girth, z); tessellator.addVertex(a, b + girth, c); @@ -169,4 +223,6 @@ public abstract class RenderPylonBase extends TileEntitySpecialRenderer { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); } + + public static final int LINE_COLOR = 0xBB3311; } diff --git a/src/main/java/com/hbm/render/tileentity/RenderPylonLarge.java b/src/main/java/com/hbm/render/tileentity/RenderPylonLarge.java index d5ad3f7ce..c68ebc79d 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderPylonLarge.java +++ b/src/main/java/com/hbm/render/tileentity/RenderPylonLarge.java @@ -3,9 +3,11 @@ package com.hbm.render.tileentity; import org.lwjgl.opengl.GL11; import com.hbm.blocks.BlockDummyable; +import com.hbm.main.MainRegistry; import com.hbm.main.ResourceManager; import com.hbm.tileentity.network.TileEntityPylonLarge; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class RenderPylonLarge extends RenderPylonBase { @@ -17,9 +19,9 @@ public class RenderPylonLarge extends RenderPylonBase { switch(tile.getBlockMetadata() - BlockDummyable.offset) { case 2: GL11.glRotatef(90, 0F, 1F, 0F); break; - case 4: GL11.glRotatef(180, 0F, 1F, 0F); break; - case 3: GL11.glRotatef(270, 0F, 1F, 0F); break; - case 5: GL11.glRotatef(0, 0F, 1F, 0F); break; + case 4: GL11.glRotatef(135, 0F, 1F, 0F); break; + case 3: GL11.glRotatef(0, 0F, 1F, 0F); break; + case 5: GL11.glRotatef(45, 0F, 1F, 0F); break; } GL11.glDisable(GL11.GL_CULL_FACE); diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityPylonBase.java b/src/main/java/com/hbm/tileentity/network/TileEntityPylonBase.java index a4824bd2f..93a185e27 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityPylonBase.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityPylonBase.java @@ -25,18 +25,17 @@ public abstract class TileEntityPylonBase extends TileEntityCableBaseNT { return false; double len = Math.min(first.getMaxWireLength(), second.getMaxWireLength()); - double lenSq = len * len; Vec3 firstPos = first.getConnectionPoint(); Vec3 secondPos = second.getConnectionPoint(); Vec3 delta = Vec3.createVectorHelper( - (second.xCoord + secondPos.xCoord) - (first.xCoord + firstPos.xCoord), - (second.yCoord + secondPos.yCoord) - (first.yCoord + firstPos.yCoord), - (second.zCoord + secondPos.zCoord) - (first.zCoord + firstPos.zCoord) + (secondPos.xCoord) - (firstPos.xCoord), + (secondPos.yCoord) - (firstPos.yCoord), + (secondPos.zCoord) - (firstPos.zCoord) ); - return Math.sqrt(lenSq) >= delta.lengthVector(); + return len >= delta.lengthVector(); } public void addConnection(int x, int y, int z) { diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityPylonLarge.java b/src/main/java/com/hbm/tileentity/network/TileEntityPylonLarge.java index 8cbe4638c..f0ef0c3d5 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityPylonLarge.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityPylonLarge.java @@ -1,5 +1,7 @@ package com.hbm.tileentity.network; +import com.hbm.blocks.BlockDummyable; + import net.minecraft.util.Vec3; public class TileEntityPylonLarge extends TileEntityPylonBase { @@ -13,11 +15,21 @@ public class TileEntityPylonLarge extends TileEntityPylonBase { public Vec3[] getMountPos() { double topOff = 0.75 + 0.0625; double sideOff = 3.375; + + Vec3 vec = Vec3.createVectorHelper(sideOff, 0, 0); + + switch(getBlockMetadata() - BlockDummyable.offset) { + case 2: vec.rotateAroundY((float) Math.PI * 0.0F); break; + case 4: vec.rotateAroundY((float) Math.PI * 0.25F); break; + case 3: vec.rotateAroundY((float) Math.PI * 0.5F); break; + case 5: vec.rotateAroundY((float) Math.PI * 0.75F); break; + } + return new Vec3[] { - Vec3.createVectorHelper(0.5 + sideOff, 11.5 + topOff, 0.5), - Vec3.createVectorHelper(0.5 + sideOff, 11.5 - topOff, 0.5), - Vec3.createVectorHelper(0.5 - sideOff, 11.5 + topOff, 0.5), - Vec3.createVectorHelper(0.5 - sideOff, 11.5 - topOff, 0.5), + Vec3.createVectorHelper(0.5 + vec.xCoord, 11.5 + topOff, 0.5 + vec.zCoord), + Vec3.createVectorHelper(0.5 + vec.xCoord, 11.5 - topOff, 0.5 + vec.zCoord), + Vec3.createVectorHelper(0.5 - vec.xCoord, 11.5 + topOff, 0.5 - vec.zCoord), + Vec3.createVectorHelper(0.5 - vec.xCoord, 11.5 - topOff, 0.5 - vec.zCoord), }; } diff --git a/src/main/java/com/hbm/util/ChatBuilder.java b/src/main/java/com/hbm/util/ChatBuilder.java new file mode 100644 index 000000000..6ed56f8ee --- /dev/null +++ b/src/main/java/com/hbm/util/ChatBuilder.java @@ -0,0 +1,47 @@ +package com.hbm.util; + +import net.minecraft.util.ChatComponentStyle; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.ChatStyle; +import net.minecraft.util.EnumChatFormatting; + +public class ChatBuilder { + + private ChatComponentText text; + private ChatComponentStyle last; + + private ChatBuilder(String text) { + this.text = new ChatComponentText(text); + this.last = this.text; + } + + public static ChatBuilder start(String text) { + ChatBuilder builder = new ChatBuilder(text); + return builder; + } + + public ChatBuilder next(String text) { + ChatComponentText append = new ChatComponentText(text); + this.last.appendSibling(append); + this.last = append; + return this; + } + + public ChatBuilder nextTranslation(String text) { + ChatComponentTranslation append = new ChatComponentTranslation(text); + this.last.appendSibling(append); + this.last = append; + return this; + } + + public ChatBuilder color(EnumChatFormatting format) { + ChatStyle style = this.last.getChatStyle(); + style.setColor(format); + return this; + } + + public ChatComponentText flush() { + return this.text; + } +} diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 75a25f27f..e007f6d33 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -100,6 +100,13 @@ armor.thermal=Wärmebildkamera armor.threshold=Schadensschwelle: %s armor.vats=Feinde-HUD +bomb.detonated=Erfolgreich gezündet! +bomb.incompatible=Gerät kann nicht ausgelöst werden! +bomb.launched=Erfolgreich gestartet! +bomb.missingComponent=Komponente fehlt! +bomb.nobomb=Verbundene Position nicht kompatibel oder nicht geladen! +bomb.triggered=Erfolgreich ausgelöst! + book.test.page1=Testseite 1 chem.ASPHALT=Asphaltherstellung diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index b740ad405..0426c1e43 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -140,6 +140,13 @@ armor.thermal=Thermal Sight armor.threshold=Damage threshold of %s armor.vats=Enemy HUD +bomb.detonated=Detonated successfully! +bomb.incompatible=Device can not be triggered! +bomb.launched=Launched successfully! +bomb.missingComponent=Component missing! +bomb.nobomb=Linked position incompatible or unloaded! +bomb.triggered=Triggered successfully! + book.test.cover=HOW 2 SEX book.test.page1=Test Page 1 diff --git a/src/main/resources/assets/hbm/models/weapons/charge_dynamite.obj b/src/main/resources/assets/hbm/models/weapons/charge_dynamite.obj new file mode 100644 index 000000000..7837bd8d1 --- /dev/null +++ b/src/main/resources/assets/hbm/models/weapons/charge_dynamite.obj @@ -0,0 +1,181 @@ +# Blender v2.79 (sub 0) OBJ File: 'charge_dynamite.blend' +# www.blender.org +o Plane +v -0.125000 -0.500000 0.437500 +v 0.125000 -0.500000 0.437500 +v -0.125000 -0.500000 -0.437500 +v 0.125000 -0.500000 -0.437500 +v -0.125000 -0.250000 0.437500 +v 0.125000 -0.250000 0.437500 +v -0.125000 -0.250000 -0.437500 +v 0.125000 -0.250000 -0.437500 +v 0.187500 -0.500000 0.437500 +v 0.437500 -0.500000 0.437500 +v 0.187500 -0.500000 -0.437500 +v 0.437500 -0.500000 -0.437500 +v 0.187500 -0.250000 0.437500 +v 0.437500 -0.250000 0.437500 +v 0.187500 -0.250000 -0.437500 +v 0.437500 -0.250000 -0.437500 +v -0.437500 -0.500000 0.437500 +v -0.187500 -0.500000 0.437500 +v -0.437500 -0.500000 -0.437500 +v -0.187500 -0.500000 -0.437500 +v -0.437500 -0.250000 0.437500 +v -0.187500 -0.250000 0.437500 +v -0.437500 -0.250000 -0.437500 +v -0.187500 -0.250000 -0.437500 +v -0.250000 -0.312500 0.250000 +v 0.250000 -0.312500 0.250000 +v -0.250000 -0.312500 -0.250000 +v 0.250000 -0.312500 -0.250000 +v -0.250000 -0.187500 -0.250000 +v -0.250000 -0.187500 0.250000 +v 0.250000 -0.187500 0.250000 +v 0.250000 -0.187500 -0.250000 +vt 0.875000 0.000000 +vt -0.000000 0.250000 +vt -0.000000 0.000000 +vt -0.000000 0.000000 +vt 0.875000 0.250000 +vt -0.000000 0.250000 +vt 0.875000 -0.000000 +vt -0.000000 0.250000 +vt -0.000000 -0.000000 +vt -0.000000 0.250000 +vt 0.875000 0.000000 +vt 0.875000 0.250000 +vt 0.250000 0.250000 +vt 0.000000 0.500000 +vt 0.000000 0.250000 +vt 0.250000 0.250000 +vt -0.000000 0.500000 +vt 0.875000 0.000000 +vt -0.000000 0.250000 +vt -0.000000 0.000000 +vt -0.000000 0.000000 +vt 0.875000 0.250000 +vt -0.000000 0.250000 +vt 0.875000 -0.000000 +vt -0.000000 0.250000 +vt -0.000000 -0.000000 +vt -0.000000 0.250000 +vt 0.875000 0.000000 +vt 0.875000 0.250000 +vt 0.250000 0.250000 +vt 0.000000 0.500000 +vt 0.000000 0.250000 +vt 0.250000 0.250000 +vt -0.000000 0.500000 +vt 0.875000 0.000000 +vt -0.000000 0.250000 +vt -0.000000 0.000000 +vt -0.000000 0.000000 +vt 0.875000 0.250000 +vt -0.000000 0.250000 +vt 0.875000 -0.000000 +vt -0.000000 0.250000 +vt -0.000000 -0.000000 +vt -0.000000 0.250000 +vt 0.875000 0.000000 +vt 0.875000 0.250000 +vt 0.250000 0.250000 +vt 0.000000 0.500000 +vt 0.000000 0.250000 +vt 0.250000 0.250000 +vt -0.000000 0.500000 +vt 0.250000 0.875000 +vt 0.750000 0.375000 +vt 0.750000 0.875000 +vt 0.250000 0.375000 +vt 0.750000 0.875000 +vt 0.250000 0.875000 +vt 0.750000 0.250000 +vt 0.250000 0.375000 +vt 0.250000 0.250000 +vt 0.750000 0.250000 +vt 0.250000 0.375000 +vt 0.250000 0.250000 +vt 0.750000 0.250000 +vt 0.250000 0.250000 +vt 0.750000 0.250000 +vt 0.250000 0.375000 +vt 0.250000 0.250000 +vt 0.875000 0.250000 +vt 0.875000 0.000000 +vt 0.875000 0.250000 +vt -0.000000 0.000000 +vt 0.250000 0.500000 +vt 0.250000 0.500000 +vt 0.875000 0.250000 +vt 0.875000 0.000000 +vt 0.875000 0.250000 +vt -0.000000 0.000000 +vt 0.250000 0.500000 +vt 0.250000 0.500000 +vt 0.875000 0.250000 +vt 0.875000 0.000000 +vt 0.875000 0.250000 +vt -0.000000 0.000000 +vt 0.250000 0.500000 +vt 0.250000 0.500000 +vt 0.250000 0.375000 +vt 0.750000 0.375000 +vt 0.750000 0.375000 +vt 0.750000 0.375000 +vt 0.750000 0.375000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 1.0000 0.0000 0.0000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 0.0000 -1.0000 +vn 0.0000 0.0000 1.0000 +s off +f 3/1/1 2/2/1 1/3/1 +f 6/4/2 7/5/2 5/6/2 +f 4/7/3 6/8/3 2/9/3 +f 1/10/4 7/11/4 3/12/4 +f 3/13/5 8/14/5 4/15/5 +f 2/16/6 5/17/6 1/10/6 +f 11/18/1 10/19/1 9/20/1 +f 14/21/2 15/22/2 13/23/2 +f 12/24/3 14/25/3 10/26/3 +f 9/27/4 15/28/4 11/29/4 +f 11/30/5 16/31/5 12/32/5 +f 10/33/6 13/34/6 9/27/6 +f 19/35/1 18/36/1 17/37/1 +f 22/38/2 23/39/2 21/40/2 +f 20/41/3 22/42/3 18/43/3 +f 17/44/4 23/45/4 19/46/4 +f 19/47/5 24/48/5 20/49/5 +f 18/50/6 21/51/6 17/44/6 +f 27/52/1 26/53/1 25/54/1 +f 31/55/2 29/56/2 30/57/2 +f 27/58/5 32/59/5 28/60/5 +f 26/61/6 30/62/6 25/63/6 +f 28/64/3 31/55/3 26/65/3 +f 25/66/4 29/67/4 27/68/4 +f 3/1/1 4/69/1 2/2/1 +f 6/4/2 8/70/2 7/5/2 +f 4/7/3 8/71/3 6/8/3 +f 1/10/4 5/72/4 7/11/4 +f 3/13/5 7/73/5 8/14/5 +f 2/16/6 6/74/6 5/17/6 +f 11/18/1 12/75/1 10/19/1 +f 14/21/2 16/76/2 15/22/2 +f 12/24/3 16/77/3 14/25/3 +f 9/27/4 13/78/4 15/28/4 +f 11/30/5 15/79/5 16/31/5 +f 10/33/6 14/80/6 13/34/6 +f 19/35/1 20/81/1 18/36/1 +f 22/38/2 24/82/2 23/39/2 +f 20/41/3 24/83/3 22/42/3 +f 17/44/4 21/84/4 23/45/4 +f 19/47/5 23/85/5 24/48/5 +f 18/50/6 22/86/6 21/51/6 +f 27/52/1 28/87/1 26/53/1 +f 31/55/2 32/88/2 29/56/2 +f 27/58/5 29/89/5 32/59/5 +f 26/61/6 31/90/6 30/62/6 +f 28/64/3 32/88/3 31/55/3 +f 25/66/4 30/91/4 29/67/4 diff --git a/src/main/resources/assets/hbm/textures/blocks/red_pylon_large.png b/src/main/resources/assets/hbm/textures/blocks/red_pylon_large.png new file mode 100644 index 0000000000000000000000000000000000000000..eb27ca97eebcfb5a12b865b756e2c9b3384a5576 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vfzopr04x