diff --git a/src/tconstruct/TConstruct.java b/src/tconstruct/TConstruct.java index c245887e..e57c646c 100644 --- a/src/tconstruct/TConstruct.java +++ b/src/tconstruct/TConstruct.java @@ -98,7 +98,7 @@ public class TConstruct proxy.addNames(); proxy.readManuals(); proxy.registerKeys(); - + MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler()); GameRegistry.registerWorldGenerator(new TBaseWorldGenerator()); diff --git a/src/tconstruct/blocks/BlockLandmine.java b/src/tconstruct/blocks/BlockLandmine.java index 2e72fbf7..51b6088a 100644 --- a/src/tconstruct/blocks/BlockLandmine.java +++ b/src/tconstruct/blocks/BlockLandmine.java @@ -521,36 +521,37 @@ public class BlockLandmine extends BlockContainer return par1World.isBlockIndirectlyGettingPowered(par2, par3, par4) ? 1 : 0; } - protected AxisAlignedBB getSensitiveAABB(World par1World, int par2, int par3, int par4){ + protected AxisAlignedBB getSensitiveAABB (World par1World, int par2, int par3, int par4) + { float f = 0.125F; -// return AxisAlignedBB.getAABBPool().getAABB((double)((float)par1 + f), (double)par2, (double)((float)par3 + f), (double)((float)(par1 + 1) - f), (double)par2 + 0.25D, (double)((float)(par3 + 1) - f)); - + // return AxisAlignedBB.getAABBPool().getAABB((double)((float)par1 + f), (double)par2, (double)((float)par3 + f), (double)((float)(par1 + 1) - f), (double)par2 + 0.25D, (double)((float)(par3 + 1) - f)); + int l = par1World.getBlockMetadata(par2, par3, par4); int i1 = l & 7; boolean flag = (l & 8) > 0; float minX = par2 + f, minY = par3, minZ = par4 + f, maxX = par2 + 1 - f, maxY = par3 + 0.25F, maxZ = par4 + 1 - f; - + ForgeDirection dir = Helper.convertMetaToForgeOrientation(i1); switch (dir) { case DOWN: break; case UP: - minY = par3 + 0.75F; - maxY = par3 + 1; + minY = par3 + 0.75F; + maxY = par3 + 1; break; default: - minX = par2; - minY = par3; - minZ = par4; - maxX = par2 + 1; - maxY = par3 + 1; - maxZ = par4 + 1; + minX = par2; + minY = par3; + minZ = par4; + maxX = par2 + 1; + maxY = par3 + 1; + maxZ = par4 + 1; } - return AxisAlignedBB.getAABBPool().getAABB(minX, minY, minZ, maxX, maxY, maxZ); + return AxisAlignedBB.getAABBPool().getAABB(minX, minY, minZ, maxX, maxY, maxZ); } - + public Entity getMineTriggerer (World par1World, int par2, int par3, int par4) { diff --git a/src/tconstruct/blocks/CastingChannelBlock.java b/src/tconstruct/blocks/CastingChannelBlock.java index 7e408b22..7e89fbf8 100644 --- a/src/tconstruct/blocks/CastingChannelBlock.java +++ b/src/tconstruct/blocks/CastingChannelBlock.java @@ -42,7 +42,7 @@ public class CastingChannelBlock extends BlockContainer { //int amount = 0; //if (tile.getFluid() != null) - //amount = tile.getLiquidAmount(); + //amount = tile.getLiquidAmount(); //player.addChatMessage("LiquidAmount: " + amount); tile.setActive(true); } diff --git a/src/tconstruct/blocks/ConveyorBase.java b/src/tconstruct/blocks/ConveyorBase.java index a6cde53b..a376c26b 100644 --- a/src/tconstruct/blocks/ConveyorBase.java +++ b/src/tconstruct/blocks/ConveyorBase.java @@ -25,26 +25,26 @@ public class ConveyorBase extends Block this.setCreativeTab(TConstructRegistry.blockTab); setBlockBounds(0f, 0f, 0f, 1f, 0.5f, 1f); } - - public boolean isBlockReplaceable(World world, int x, int y, int z) + + public boolean isBlockReplaceable (World world, int x, int y, int z) { return false; } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z) { return null; } @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) + public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity) { if (!world.isBlockIndirectlyGettingPowered(x, y, z)) { double moveX = 0; double moveZ = 0; - + double speed = 0.01; int meta = world.getBlockMetadata(x, y, z); @@ -56,7 +56,7 @@ public class ConveyorBase extends Block case 7: moveX += speed; moveZ += speed; - break; + break; case 0: moveZ += speed; break; @@ -82,22 +82,22 @@ public class ConveyorBase extends Block entity.addVelocity(moveX, 0, moveZ); } - + if (entity instanceof EntityItem) { - ((EntityItem)entity).age = 0; + ((EntityItem) entity).age = 0; } } - + @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) + public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D) + (entity.isSneaking() ? 4 : 0) & 7; int meta = world.getBlockMetadata(x, y, z) & 8; world.setBlockMetadataWithNotify(x, y, z, face | meta, 2); } - - public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) + + public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side) { if (side == 1) return false; @@ -108,31 +108,31 @@ public class ConveyorBase extends Block /* Rendering */ @Override - public boolean renderAsNormalBlock() + public boolean renderAsNormalBlock () { return false; } @Override - public boolean isOpaqueCube() + public boolean isOpaqueCube () { return false; } @Override - public int getRenderBlockPass() + public int getRenderBlockPass () { return 1; } @Override - public int getRenderType() + public int getRenderType () { return SlimeChannelRender.model; } @Override - public void registerIcons(IconRegister iconRegister) + public void registerIcons (IconRegister iconRegister) { String[] textureNames = new String[] { "greencurrent", "greencurrent_flow" }; this.icons = new Icon[textureNames.length]; @@ -145,7 +145,7 @@ public class ConveyorBase extends Block @Override @SideOnly(Side.CLIENT) - public Icon getIcon(int side, int meta) + public Icon getIcon (int side, int meta) { if (meta >= 8) return icons[0]; diff --git a/src/tconstruct/blocks/EquipBlock.java b/src/tconstruct/blocks/EquipBlock.java index e9879697..41b6a063 100644 --- a/src/tconstruct/blocks/EquipBlock.java +++ b/src/tconstruct/blocks/EquipBlock.java @@ -123,7 +123,8 @@ public class EquipBlock extends InventoryBlock } @Override - public void breakBlock (World par1World, int x, int y, int z, int par5, int meta){ + public void breakBlock (World par1World, int x, int y, int z, int par5, int meta) + { TileEntity te = par1World.getBlockTileEntity(x, y, z); if (te != null && te instanceof EquipLogic) @@ -169,7 +170,7 @@ public class EquipBlock extends InventoryBlock super.breakBlock(par1World, x, y, z, par5, meta); } - + public int getLightValue (IBlockAccess world, int x, int y, int z) { return !isActive(world, x, y, z) ? 0 : 9; diff --git a/src/tconstruct/blocks/GlassBlockConnected.java b/src/tconstruct/blocks/GlassBlockConnected.java index cfbd9297..ab24a890 100644 --- a/src/tconstruct/blocks/GlassBlockConnected.java +++ b/src/tconstruct/blocks/GlassBlockConnected.java @@ -29,10 +29,11 @@ public class GlassBlockConnected extends Block setHardness(0.3F); this.setCreativeTab(TConstructRegistry.blockTab); } - + //For FMP support - public Icon[] getIcons(){ - return icons; + public Icon[] getIcons () + { + return icons; } @Override diff --git a/src/tconstruct/blocks/GlassPaneConnected.java b/src/tconstruct/blocks/GlassPaneConnected.java index 54c434e6..0009ed94 100644 --- a/src/tconstruct/blocks/GlassPaneConnected.java +++ b/src/tconstruct/blocks/GlassPaneConnected.java @@ -15,440 +15,683 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; -public class GlassPaneConnected extends GlassBlockConnected { +public class GlassPaneConnected extends GlassBlockConnected +{ - private Icon theIcon; + private Icon theIcon; - public GlassPaneConnected(int par1, String location, boolean hasAlpha) { - super(par1, location, hasAlpha); - } + public GlassPaneConnected(int par1, String location, boolean hasAlpha) + { + super(par1, location, hasAlpha); + } - @Override - public int getRenderType() { - return PaneConnectedRender.model; - // return 0; - } + @Override + public int getRenderType () + { + return PaneConnectedRender.model; + // return 0; + } - @Override - public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { - if (par5 == 0 || par5 == 1) { - return par1IBlockAccess.getBlockId(par2, par3 - 1, par4) == this.blockID && par5 == 0 ? icons[15] : par1IBlockAccess.getBlockId(par2, par3 + 1, par4) == this.blockID && par5 == 1 ? icons[15] : getSideTextureIndex(); - } else { - return super.getBlockTexture(par1IBlockAccess, par2, par3, par4, par5); - } - } + @Override + public Icon getBlockTexture (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (par5 == 0 || par5 == 1) + { + return par1IBlockAccess.getBlockId(par2, par3 - 1, par4) == this.blockID && par5 == 0 ? icons[15] + : par1IBlockAccess.getBlockId(par2, par3 + 1, par4) == this.blockID && par5 == 1 ? icons[15] : getSideTextureIndex(); + } + else + { + return super.getBlockTexture(par1IBlockAccess, par2, par3, par4, par5); + } + } - @Override - public Icon getConnectedBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, Icon[] icons) { - if (par5 == 0 || par5 == 1) { - return getSideTextureIndex(); - } + @Override + public Icon getConnectedBlockTexture (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5, Icon[] icons) + { + if (par5 == 0 || par5 == 1) + { + return getSideTextureIndex(); + } - if (PHConstruct.connectedTexturesMode == 0) { - return icons[0]; - } + if (PHConstruct.connectedTexturesMode == 0) + { + return icons[0]; + } - boolean isOpenUp = false, isOpenDown = false, isOpenLeft = false, isOpenRight = false; + boolean isOpenUp = false, isOpenDown = false, isOpenLeft = false, isOpenRight = false; - switch (par5) { - case 0: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { - isOpenDown = true; - } + switch (par5) + { + case 0: + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) + { + isOpenDown = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { - isOpenUp = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) + { + isOpenUp = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { - isOpenLeft = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) + { + isOpenLeft = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { - isOpenRight = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) + { + isOpenRight = true; + } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { - return icons[15]; - } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[11]; - } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[12]; - } else if (isOpenUp && isOpenLeft && isOpenRight) { - return icons[13]; - } else if (isOpenDown && isOpenLeft && isOpenRight) { - return icons[14]; - } else if (isOpenDown && isOpenUp) { - return icons[5]; - } else if (isOpenLeft && isOpenRight) { - return icons[6]; - } else if (isOpenDown && isOpenLeft) { - return icons[8]; - } else if (isOpenDown && isOpenRight) { - return icons[10]; - } else if (isOpenUp && isOpenLeft) { - return icons[7]; - } else if (isOpenUp && isOpenRight) { - return icons[9]; - } else if (isOpenDown) { - return icons[3]; - } else if (isOpenUp) { - return icons[4]; - } else if (isOpenLeft) { - return icons[2]; - } else if (isOpenRight) { - return icons[1]; - } - break; - case 1: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { - isOpenDown = true; - } + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) + { + return icons[15]; + } + else if (isOpenUp && isOpenDown && isOpenLeft) + { + return icons[11]; + } + else if (isOpenUp && isOpenDown && isOpenRight) + { + return icons[12]; + } + else if (isOpenUp && isOpenLeft && isOpenRight) + { + return icons[13]; + } + else if (isOpenDown && isOpenLeft && isOpenRight) + { + return icons[14]; + } + else if (isOpenDown && isOpenUp) + { + return icons[5]; + } + else if (isOpenLeft && isOpenRight) + { + return icons[6]; + } + else if (isOpenDown && isOpenLeft) + { + return icons[8]; + } + else if (isOpenDown && isOpenRight) + { + return icons[10]; + } + else if (isOpenUp && isOpenLeft) + { + return icons[7]; + } + else if (isOpenUp && isOpenRight) + { + return icons[9]; + } + else if (isOpenDown) + { + return icons[3]; + } + else if (isOpenUp) + { + return icons[4]; + } + else if (isOpenLeft) + { + return icons[2]; + } + else if (isOpenRight) + { + return icons[1]; + } + break; + case 1: + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) + { + isOpenDown = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { - isOpenUp = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) + { + isOpenUp = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { - isOpenLeft = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) + { + isOpenLeft = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { - isOpenRight = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) + { + isOpenRight = true; + } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { - return icons[15]; - } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[11]; - } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[12]; - } else if (isOpenUp && isOpenLeft && isOpenRight) { - return icons[13]; - } else if (isOpenDown && isOpenLeft && isOpenRight) { - return icons[14]; - } else if (isOpenDown && isOpenUp) { - return icons[5]; - } else if (isOpenLeft && isOpenRight) { - return icons[6]; - } else if (isOpenDown && isOpenLeft) { - return icons[8]; - } else if (isOpenDown && isOpenRight) { - return icons[10]; - } else if (isOpenUp && isOpenLeft) { - return icons[7]; - } else if (isOpenUp && isOpenRight) { - return icons[9]; - } else if (isOpenDown) { - return icons[3]; - } else if (isOpenUp) { - return icons[4]; - } else if (isOpenLeft) { - return icons[2]; - } else if (isOpenRight) { - return icons[1]; - } - break; - case 2: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { - isOpenDown = true; - } + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) + { + return icons[15]; + } + else if (isOpenUp && isOpenDown && isOpenLeft) + { + return icons[11]; + } + else if (isOpenUp && isOpenDown && isOpenRight) + { + return icons[12]; + } + else if (isOpenUp && isOpenLeft && isOpenRight) + { + return icons[13]; + } + else if (isOpenDown && isOpenLeft && isOpenRight) + { + return icons[14]; + } + else if (isOpenDown && isOpenUp) + { + return icons[5]; + } + else if (isOpenLeft && isOpenRight) + { + return icons[6]; + } + else if (isOpenDown && isOpenLeft) + { + return icons[8]; + } + else if (isOpenDown && isOpenRight) + { + return icons[10]; + } + else if (isOpenUp && isOpenLeft) + { + return icons[7]; + } + else if (isOpenUp && isOpenRight) + { + return icons[9]; + } + else if (isOpenDown) + { + return icons[3]; + } + else if (isOpenUp) + { + return icons[4]; + } + else if (isOpenLeft) + { + return icons[2]; + } + else if (isOpenRight) + { + return icons[1]; + } + break; + case 2: + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) + { + isOpenDown = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { - isOpenUp = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) + { + isOpenUp = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { - isOpenLeft = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) + { + isOpenLeft = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { - isOpenRight = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) + { + isOpenRight = true; + } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { - return icons[15]; - } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[13]; - } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[14]; - } else if (isOpenUp && isOpenLeft && isOpenRight) { - return icons[11]; - } else if (isOpenDown && isOpenLeft && isOpenRight) { - return icons[12]; - } else if (isOpenDown && isOpenUp) { - return icons[6]; - } else if (isOpenLeft && isOpenRight) { - return icons[5]; - } else if (isOpenDown && isOpenLeft) { - return icons[9]; - } else if (isOpenDown && isOpenRight) { - return icons[10]; - } else if (isOpenUp && isOpenLeft) { - return icons[7]; - } else if (isOpenUp && isOpenRight) { - return icons[8]; - } else if (isOpenDown) { - return icons[1]; - } else if (isOpenUp) { - return icons[2]; - } else if (isOpenLeft) { - return icons[4]; - } else if (isOpenRight) { - return icons[3]; - } - break; - case 3: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { - isOpenDown = true; - } + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) + { + return icons[15]; + } + else if (isOpenUp && isOpenDown && isOpenLeft) + { + return icons[13]; + } + else if (isOpenUp && isOpenDown && isOpenRight) + { + return icons[14]; + } + else if (isOpenUp && isOpenLeft && isOpenRight) + { + return icons[11]; + } + else if (isOpenDown && isOpenLeft && isOpenRight) + { + return icons[12]; + } + else if (isOpenDown && isOpenUp) + { + return icons[6]; + } + else if (isOpenLeft && isOpenRight) + { + return icons[5]; + } + else if (isOpenDown && isOpenLeft) + { + return icons[9]; + } + else if (isOpenDown && isOpenRight) + { + return icons[10]; + } + else if (isOpenUp && isOpenLeft) + { + return icons[7]; + } + else if (isOpenUp && isOpenRight) + { + return icons[8]; + } + else if (isOpenDown) + { + return icons[1]; + } + else if (isOpenUp) + { + return icons[2]; + } + else if (isOpenLeft) + { + return icons[4]; + } + else if (isOpenRight) + { + return icons[3]; + } + break; + case 3: + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) + { + isOpenDown = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { - isOpenUp = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) + { + isOpenUp = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) { - isOpenLeft = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 - 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 - 1, par3, par4))) + { + isOpenLeft = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) { - isOpenRight = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2 + 1, par3, par4), par1IBlockAccess.getBlockMetadata(par2 + 1, par3, par4))) + { + isOpenRight = true; + } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { - return icons[15]; - } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[14]; - } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[13]; - } else if (isOpenUp && isOpenLeft && isOpenRight) { - return icons[11]; - } else if (isOpenDown && isOpenLeft && isOpenRight) { - return icons[12]; - } else if (isOpenDown && isOpenUp) { - return icons[6]; - } else if (isOpenLeft && isOpenRight) { - return icons[5]; - } else if (isOpenDown && isOpenLeft) { - return icons[10]; - } else if (isOpenDown && isOpenRight) { - return icons[9]; - } else if (isOpenUp && isOpenLeft) { - return icons[8]; - } else if (isOpenUp && isOpenRight) { - return icons[7]; - } else if (isOpenDown) { - return icons[1]; - } else if (isOpenUp) { - return icons[2]; - } else if (isOpenLeft) { - return icons[3]; - } else if (isOpenRight) { - return icons[4]; - } - break; - case 4: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { - isOpenDown = true; - } + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) + { + return icons[15]; + } + else if (isOpenUp && isOpenDown && isOpenLeft) + { + return icons[14]; + } + else if (isOpenUp && isOpenDown && isOpenRight) + { + return icons[13]; + } + else if (isOpenUp && isOpenLeft && isOpenRight) + { + return icons[11]; + } + else if (isOpenDown && isOpenLeft && isOpenRight) + { + return icons[12]; + } + else if (isOpenDown && isOpenUp) + { + return icons[6]; + } + else if (isOpenLeft && isOpenRight) + { + return icons[5]; + } + else if (isOpenDown && isOpenLeft) + { + return icons[10]; + } + else if (isOpenDown && isOpenRight) + { + return icons[9]; + } + else if (isOpenUp && isOpenLeft) + { + return icons[8]; + } + else if (isOpenUp && isOpenRight) + { + return icons[7]; + } + else if (isOpenDown) + { + return icons[1]; + } + else if (isOpenUp) + { + return icons[2]; + } + else if (isOpenLeft) + { + return icons[3]; + } + else if (isOpenRight) + { + return icons[4]; + } + break; + case 4: + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) + { + isOpenDown = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { - isOpenUp = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) + { + isOpenUp = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { - isOpenLeft = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) + { + isOpenLeft = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { - isOpenRight = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) + { + isOpenRight = true; + } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { - return icons[15]; - } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[14]; - } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[13]; - } else if (isOpenUp && isOpenLeft && isOpenRight) { - return icons[11]; - } else if (isOpenDown && isOpenLeft && isOpenRight) { - return icons[12]; - } else if (isOpenDown && isOpenUp) { - return icons[6]; - } else if (isOpenLeft && isOpenRight) { - return icons[5]; - } else if (isOpenDown && isOpenLeft) { - return icons[10]; - } else if (isOpenDown && isOpenRight) { - return icons[9]; - } else if (isOpenUp && isOpenLeft) { - return icons[8]; - } else if (isOpenUp && isOpenRight) { - return icons[7]; - } else if (isOpenDown) { - return icons[1]; - } else if (isOpenUp) { - return icons[2]; - } else if (isOpenLeft) { - return icons[3]; - } else if (isOpenRight) { - return icons[4]; - } - break; - case 5: - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) { - isOpenDown = true; - } + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) + { + return icons[15]; + } + else if (isOpenUp && isOpenDown && isOpenLeft) + { + return icons[14]; + } + else if (isOpenUp && isOpenDown && isOpenRight) + { + return icons[13]; + } + else if (isOpenUp && isOpenLeft && isOpenRight) + { + return icons[11]; + } + else if (isOpenDown && isOpenLeft && isOpenRight) + { + return icons[12]; + } + else if (isOpenDown && isOpenUp) + { + return icons[6]; + } + else if (isOpenLeft && isOpenRight) + { + return icons[5]; + } + else if (isOpenDown && isOpenLeft) + { + return icons[10]; + } + else if (isOpenDown && isOpenRight) + { + return icons[9]; + } + else if (isOpenUp && isOpenLeft) + { + return icons[8]; + } + else if (isOpenUp && isOpenRight) + { + return icons[7]; + } + else if (isOpenDown) + { + return icons[1]; + } + else if (isOpenUp) + { + return icons[2]; + } + else if (isOpenLeft) + { + return icons[3]; + } + else if (isOpenRight) + { + return icons[4]; + } + break; + case 5: + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 - 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 - 1, par4))) + { + isOpenDown = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) { - isOpenUp = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3 + 1, par4), par1IBlockAccess.getBlockMetadata(par2, par3 + 1, par4))) + { + isOpenUp = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) { - isOpenLeft = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 - 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 - 1))) + { + isOpenLeft = true; + } - if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) { - isOpenRight = true; - } + if (shouldConnectToBlock(par1IBlockAccess, par2, par3, par4, par1IBlockAccess.getBlockId(par2, par3, par4 + 1), par1IBlockAccess.getBlockMetadata(par2, par3, par4 + 1))) + { + isOpenRight = true; + } - if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) { - return icons[15]; - } else if (isOpenUp && isOpenDown && isOpenLeft) { - return icons[13]; - } else if (isOpenUp && isOpenDown && isOpenRight) { - return icons[14]; - } else if (isOpenUp && isOpenLeft && isOpenRight) { - return icons[11]; - } else if (isOpenDown && isOpenLeft && isOpenRight) { - return icons[12]; - } else if (isOpenDown && isOpenUp) { - return icons[6]; - } else if (isOpenLeft && isOpenRight) { - return icons[5]; - } else if (isOpenDown && isOpenLeft) { - return icons[9]; - } else if (isOpenDown && isOpenRight) { - return icons[10]; - } else if (isOpenUp && isOpenLeft) { - return icons[7]; - } else if (isOpenUp && isOpenRight) { - return icons[8]; - } else if (isOpenDown) { - return icons[1]; - } else if (isOpenUp) { - return icons[2]; - } else if (isOpenLeft) { - return icons[4]; - } else if (isOpenRight) { - return icons[3]; - } - break; - } + if (isOpenUp && isOpenDown && isOpenLeft && isOpenRight) + { + return icons[15]; + } + else if (isOpenUp && isOpenDown && isOpenLeft) + { + return icons[13]; + } + else if (isOpenUp && isOpenDown && isOpenRight) + { + return icons[14]; + } + else if (isOpenUp && isOpenLeft && isOpenRight) + { + return icons[11]; + } + else if (isOpenDown && isOpenLeft && isOpenRight) + { + return icons[12]; + } + else if (isOpenDown && isOpenUp) + { + return icons[6]; + } + else if (isOpenLeft && isOpenRight) + { + return icons[5]; + } + else if (isOpenDown && isOpenLeft) + { + return icons[9]; + } + else if (isOpenDown && isOpenRight) + { + return icons[10]; + } + else if (isOpenUp && isOpenLeft) + { + return icons[7]; + } + else if (isOpenUp && isOpenRight) + { + return icons[8]; + } + else if (isOpenDown) + { + return icons[1]; + } + else if (isOpenUp) + { + return icons[2]; + } + else if (isOpenLeft) + { + return icons[4]; + } + else if (isOpenRight) + { + return icons[3]; + } + break; + } - return icons[0]; - } + return icons[0]; + } - @Override - public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) { - boolean flag = this.canPaneConnectTo(par1World, par2, par3, par4, ForgeDirection.NORTH); - boolean flag1 = this.canPaneConnectTo(par1World, par2, par3, par4, ForgeDirection.SOUTH); - boolean flag2 = this.canPaneConnectTo(par1World, par2, par3, par4, ForgeDirection.WEST); - boolean flag3 = this.canPaneConnectTo(par1World, par2, par3, par4, ForgeDirection.EAST); + @Override + public void addCollisionBoxesToList (World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) + { + boolean flag = this.canPaneConnectTo(par1World, par2, par3, par4, ForgeDirection.NORTH); + boolean flag1 = this.canPaneConnectTo(par1World, par2, par3, par4, ForgeDirection.SOUTH); + boolean flag2 = this.canPaneConnectTo(par1World, par2, par3, par4, ForgeDirection.WEST); + boolean flag3 = this.canPaneConnectTo(par1World, par2, par3, par4, ForgeDirection.EAST); - if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) { - if (flag2 && !flag3) { - this.setBlockBounds(0.0F, 0.0F, 0.4375F, 0.5F, 1.0F, 0.5625F); - super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); - } else if (!flag2 && flag3) { - this.setBlockBounds(0.5F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); - super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); - } - } else { - this.setBlockBounds(0.0F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); - super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); - } + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { + if (flag2 && !flag3) + { + this.setBlockBounds(0.0F, 0.0F, 0.4375F, 0.5F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + else if (!flag2 && flag3) + { + this.setBlockBounds(0.5F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + } + else + { + this.setBlockBounds(0.0F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } - if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) { - if (flag && !flag1) { - this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 0.5F); - super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); - } else if (!flag && flag1) { - this.setBlockBounds(0.4375F, 0.0F, 0.5F, 0.5625F, 1.0F, 1.0F); - super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); - } - } else { - this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 1.0F); - super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); - } - } + if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) + { + if (flag && !flag1) + { + this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 0.5F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + else if (!flag && flag1) + { + this.setBlockBounds(0.4375F, 0.0F, 0.5F, 0.5625F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + } + else + { + this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 1.0F); + super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); + } + } - @Override - public void setBlockBoundsForItemRender() { - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } + @Override + public void setBlockBoundsForItemRender () + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { - float f = 0.4375F; - float f1 = 0.5625F; - float f2 = 0.4375F; - float f3 = 0.5625F; - boolean flag = this.canPaneConnectTo(par1IBlockAccess, par2, par3, par4, ForgeDirection.NORTH); - boolean flag1 = this.canPaneConnectTo(par1IBlockAccess, par2, par3, par4, ForgeDirection.SOUTH); - boolean flag2 = this.canPaneConnectTo(par1IBlockAccess, par2, par3, par4, ForgeDirection.WEST); - boolean flag3 = this.canPaneConnectTo(par1IBlockAccess, par2, par3, par4, ForgeDirection.EAST); + @Override + public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + float f = 0.4375F; + float f1 = 0.5625F; + float f2 = 0.4375F; + float f3 = 0.5625F; + boolean flag = this.canPaneConnectTo(par1IBlockAccess, par2, par3, par4, ForgeDirection.NORTH); + boolean flag1 = this.canPaneConnectTo(par1IBlockAccess, par2, par3, par4, ForgeDirection.SOUTH); + boolean flag2 = this.canPaneConnectTo(par1IBlockAccess, par2, par3, par4, ForgeDirection.WEST); + boolean flag3 = this.canPaneConnectTo(par1IBlockAccess, par2, par3, par4, ForgeDirection.EAST); - if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) { - if (flag2 && !flag3) { - f = 0.0F; - } else if (!flag2 && flag3) { - f1 = 1.0F; - } - } else { - f = 0.0F; - f1 = 1.0F; - } + if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1)) + { + if (flag2 && !flag3) + { + f = 0.0F; + } + else if (!flag2 && flag3) + { + f1 = 1.0F; + } + } + else + { + f = 0.0F; + f1 = 1.0F; + } - if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) { - if (flag && !flag1) { - f2 = 0.0F; - } else if (!flag && flag1) { - f3 = 1.0F; - } - } else { - f2 = 0.0F; - f3 = 1.0F; - } + if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) + { + if (flag && !flag1) + { + f2 = 0.0F; + } + else if (!flag && flag1) + { + f3 = 1.0F; + } + } + else + { + f2 = 0.0F; + f3 = 1.0F; + } - this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); - } + this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); + } - public Icon getSideTextureIndex() { - return this.theIcon; - } + public Icon getSideTextureIndex () + { + return this.theIcon; + } - public final boolean canThisPaneConnectToThisBlockID(int par1) { - return Block.opaqueCubeLookup[par1] || par1 == this.blockID || par1 == Block.glass.blockID; - } + public final boolean canThisPaneConnectToThisBlockID (int par1) + { + return Block.opaqueCubeLookup[par1] || par1 == this.blockID || par1 == Block.glass.blockID; + } - public void registerIcons(IconRegister par1IconRegister) { - super.registerIcons(par1IconRegister); - this.theIcon = par1IconRegister.registerIcon("tinker:glass/" + folder + "/glass_side"); - } + public void registerIcons (IconRegister par1IconRegister) + { + super.registerIcons(par1IconRegister); + this.theIcon = par1IconRegister.registerIcon("tinker:glass/" + folder + "/glass_side"); + } - public boolean canPaneConnectTo(IBlockAccess access, int x, int y, int z, ForgeDirection dir) { - return canThisPaneConnectToThisBlockID(access.getBlockId(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) || access.isBlockSolidOnSide(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false); - } + public boolean canPaneConnectTo (IBlockAccess access, int x, int y, int z, ForgeDirection dir) + { + return canThisPaneConnectToThisBlockID(access.getBlockId(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) + || access.isBlockSolidOnSide(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false); + } - @Override - public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { -// if(par5 == 0 || par5 == 1){ -// return par1IBlockAccess.getBlockId(par2, par3, par4) != this.blockID; -// }else{ -// return true; -// } - return true; - } + @Override + public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + // if(par5 == 0 || par5 == 1){ + // return par1IBlockAccess.getBlockId(par2, par3, par4) != this.blockID; + // }else{ + // return true; + // } + return true; + } } diff --git a/src/tconstruct/blocks/MeatBlock.java b/src/tconstruct/blocks/MeatBlock.java index 96069db2..5865d2bc 100644 --- a/src/tconstruct/blocks/MeatBlock.java +++ b/src/tconstruct/blocks/MeatBlock.java @@ -182,7 +182,7 @@ public class MeatBlock extends Block { return true; } - + public boolean isBeaconBase (World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { return true; diff --git a/src/tconstruct/blocks/OreberryBush.java b/src/tconstruct/blocks/OreberryBush.java index 2955ccc3..68b1f64e 100644 --- a/src/tconstruct/blocks/OreberryBush.java +++ b/src/tconstruct/blocks/OreberryBush.java @@ -206,7 +206,7 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable return true; world.setBlock(x, y, z, blockID, meta - 4, 3); - AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.oreBerries, random.nextInt(3)+1, meta % 4 + itemMeat)); + AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.oreBerries, random.nextInt(3) + 1, meta % 4 + itemMeat)); return true; } diff --git a/src/tconstruct/blocks/RedstoneMachine.java b/src/tconstruct/blocks/RedstoneMachine.java index 96181edc..c2fe7a4a 100644 --- a/src/tconstruct/blocks/RedstoneMachine.java +++ b/src/tconstruct/blocks/RedstoneMachine.java @@ -272,7 +272,7 @@ public class RedstoneMachine extends InventoryBlock { if (direction == i) continue; - + CoordTuple coord = directions.get(i); if (this.getIndirectPowerLevelTo(world, x + coord.x, y + coord.y, z + coord.z, i) > 0 || activeRedstone(world, coord.x, y + coord.y, z + coord.z)) { diff --git a/src/tconstruct/blocks/SignalBus.java b/src/tconstruct/blocks/SignalBus.java index f080e6ff..7f5d73d9 100644 --- a/src/tconstruct/blocks/SignalBus.java +++ b/src/tconstruct/blocks/SignalBus.java @@ -53,68 +53,74 @@ import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.ForgeSubscribe; -public class SignalBus extends Block implements ITileEntityProvider { - public static class Geometry { +public class SignalBus extends Block implements ITileEntityProvider +{ + public static class Geometry + { public static double cable_width_min = 0.375D; public static double cable_width_max = 1 - cable_width_min; public static double cable_low_height = 0.2D; public static double cable_low_offset = 0.0D; - + public static double cable_high_height = 1.0D; public static double cable_high_offset = 1 - cable_low_height; - + public static double cable_extend_min = 0.0D; public static double cable_extend_max = 1.0D; - + public static double cable_corner_min = cable_high_offset - 1; public static double cable_corner_max = cable_low_height + 1; - + public static double zfight = 0.00001D; } - + public static int HITBOXES = 6; - + public Icon[] icons; public String[] textureNames = new String[] { "signalbus" }; - public SignalBus(int par1) { - super(par1, Material.circuits); + public SignalBus(int par1) + { + super(par1, Material.circuits); this.setHardness(0.1F); this.setResistance(1); this.setStepSound(soundMetalFootstep); setCreativeTab(TConstructRegistry.blockTab); - } + } - @Override - public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ) { - TileEntity te = world.getBlockTileEntity(tileX, tileY, tileZ); - if (te instanceof SignalBusLogic) { - if (((SignalBusLogic)te).getMultiblockMaster() != null) { - ((SignalBusLogic)te).getMultiblockMaster().detachBlock((IMultiblockMember)te, false); - } - } - } + @Override + public void onNeighborTileChange (World world, int x, int y, int z, int tileX, int tileY, int tileZ) + { + TileEntity te = world.getBlockTileEntity(tileX, tileY, tileZ); + if (te instanceof SignalBusLogic) + { + if (((SignalBusLogic) te).getMultiblockMaster() != null) + { + ((SignalBusLogic) te).getMultiblockMaster().detachBlock((IMultiblockMember) te, false); + } + } + } - @Override + @Override public void onNeighborBlockChange (World world, int x, int y, int z, int blockID) { - if (blockID == this.blockID) - { - return; - } - super.onNeighborBlockChange(world, x, y, z, blockID); - - TileEntity te = world.getBlockTileEntity(x, y, z); - if (te instanceof SignalBusLogic) - { - ItemStack tempStack; - float jumpX, jumpY, jumpZ; - Random rand = new Random(); - - int dropBus = ((SignalBusLogic)te).checkUnsupportedSides(); + if (blockID == this.blockID) + { + return; + } + super.onNeighborBlockChange(world, x, y, z, blockID); + + TileEntity te = world.getBlockTileEntity(x, y, z); + if (te instanceof SignalBusLogic) + { + ItemStack tempStack; + float jumpX, jumpY, jumpZ; + Random rand = new Random(); + + int dropBus = ((SignalBusLogic) te).checkUnsupportedSides(); if (dropBus > 0) { - if (((SignalBusLogic)te).checkShouldDestroy()) + if (((SignalBusLogic) te).checkShouldDestroy()) { world.setBlockToAir(x, y, z); } @@ -131,19 +137,21 @@ public class SignalBus extends Block implements ITileEntityProvider { entityitem.motionY = (double) ((float) rand.nextGaussian() * offset + 0.2F); entityitem.motionZ = (double) ((float) rand.nextGaussian() * offset); world.spawnEntityInWorld(entityitem); - + world.markBlockForUpdate(x, y, z); } - } + } } @Override - public void onBlockAdded(World world, int x, int y, int z) { - TileEntity te = world.getBlockTileEntity(x, y, z); - if (te != null && te instanceof SignalBusLogic) { - ((SignalBusLogic)te).onBlockAdded(world, x, y, z); - } - } + public void onBlockAdded (World world, int x, int y, int z) + { + TileEntity te = world.getBlockTileEntity(x, y, z); + if (te != null && te instanceof SignalBusLogic) + { + ((SignalBusLogic) te).onBlockAdded(world, x, y, z); + } + } @Override @SideOnly(Side.CLIENT) @@ -181,7 +189,7 @@ public class SignalBus extends Block implements ITileEntityProvider { { return SignalBusRender.renderID; } - + public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB collisionTest, List collisionBoxList, Entity entity) { TileEntity te = world.getBlockTileEntity(x, y, z); @@ -213,7 +221,7 @@ public class SignalBus extends Block implements ITileEntityProvider { super.addCollisionBoxesToList(world, x, y, z, collisionTest, collisionBoxList, entity); } } - + @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered (IBlockAccess par1iBlockAccess, int par2, int par3, int par4, int par5) @@ -228,8 +236,8 @@ public class SignalBus extends Block implements ITileEntityProvider { if (te instanceof SignalBusLogic) { MovingObjectPosition closest = null; - AxisAlignedBB[] boxes = getBoxes((SignalBusLogic)te); - + AxisAlignedBB[] boxes = getBoxes((SignalBusLogic) te); + double closestCalc = Double.MAX_VALUE; double hitDistance = 0D; @@ -239,7 +247,7 @@ public class SignalBus extends Block implements ITileEntityProvider { { continue; } - this.setBlockBounds((float)boxes[i].minX, (float)boxes[i].minY, (float)boxes[i].minZ, (float)boxes[i].maxX, (float)boxes[i].maxY, (float)boxes[i].maxZ); + this.setBlockBounds((float) boxes[i].minX, (float) boxes[i].minY, (float) boxes[i].minZ, (float) boxes[i].maxX, (float) boxes[i].maxY, (float) boxes[i].maxZ); MovingObjectPosition hit = super.collisionRayTrace(world, x, y, z, start, end); if (hit != null) { @@ -253,10 +261,10 @@ public class SignalBus extends Block implements ITileEntityProvider { } return closest; } - + return null; } - + private static AxisAlignedBB[] getBoxes (SignalBusLogic logic) { boolean placed[] = logic.placedSides(); @@ -273,26 +281,20 @@ public class SignalBus extends Block implements ITileEntityProvider { double maxY; double maxZ; boolean didRender = false; - + if (placed[ForgeDirection.DOWN.ordinal()]) { connected = logic.connectedSides(ForgeDirection.DOWN); corners = logic.getRenderCorners(ForgeDirection.DOWN); - renderDir = new boolean[] { - (connected[0] || placed[0] || corners[0]), - (connected[1] || placed[1] || corners[1]), - (connected[2] || placed[2] || corners[2]), - (connected[3] || placed[3] || corners[3]), - (connected[4] || placed[4] || corners[4]), - (connected[5] || placed[5] || corners[5]) - }; + renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]), + (connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) }; minX = (renderDir[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; minY = Geometry.cable_low_offset; minZ = (renderDir[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxY = Geometry.cable_low_height; maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; - + parts[0] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); didRender = true; } @@ -300,21 +302,15 @@ public class SignalBus extends Block implements ITileEntityProvider { { connected = logic.connectedSides(ForgeDirection.UP); corners = logic.getRenderCorners(ForgeDirection.UP); - renderDir = new boolean[] { - (connected[0] || placed[0] || corners[0]), - (connected[1] || placed[1] || corners[1]), - (connected[2] || placed[2] || corners[2]), - (connected[3] || placed[3] || corners[3]), - (connected[4] || placed[4] || corners[4]), - (connected[5] || placed[5] || corners[5]) - }; + renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]), + (connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) }; minX = (renderDir[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; minY = Geometry.cable_high_offset; minZ = (renderDir[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxY = Geometry.cable_high_height; maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; - + parts[1] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); didRender = true; } @@ -322,22 +318,15 @@ public class SignalBus extends Block implements ITileEntityProvider { { connected = logic.connectedSides(ForgeDirection.NORTH); corners = logic.getRenderCorners(ForgeDirection.NORTH); - renderDir = new boolean[] { - (connected[0] || placed[0] || corners[0]), - (connected[1] || placed[1] || corners[1]), - (connected[2] || placed[2] || corners[2]), - (connected[3] || placed[3] || corners[3]), - (connected[4] || placed[4] || corners[4]), - (connected[5] || placed[5] || corners[5]) - }; + renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]), + (connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) }; minX = (renderDir[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; minY = (renderDir[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; minZ = Geometry.cable_low_offset; maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxZ = Geometry.cable_low_height; - - + parts[2] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); didRender = true; } @@ -345,14 +334,8 @@ public class SignalBus extends Block implements ITileEntityProvider { { connected = logic.connectedSides(ForgeDirection.SOUTH); corners = logic.getRenderCorners(ForgeDirection.SOUTH); - renderDir = new boolean[] { - (connected[0] || placed[0] || corners[0]), - (connected[1] || placed[1] || corners[1]), - (connected[2] || placed[2] || corners[2]), - (connected[3] || placed[3] || corners[3]), - (connected[4] || placed[4] || corners[4]), - (connected[5] || placed[5] || corners[5]) - }; + renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]), + (connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) }; minX = (renderDir[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; minY = (renderDir[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; minZ = Geometry.cable_high_offset; @@ -367,14 +350,8 @@ public class SignalBus extends Block implements ITileEntityProvider { { connected = logic.connectedSides(ForgeDirection.WEST); corners = logic.getRenderCorners(ForgeDirection.WEST); - renderDir = new boolean[] { - (connected[0] || placed[0] || corners[0]), - (connected[1] || placed[1] || corners[1]), - (connected[2] || placed[2] || corners[2]), - (connected[3] || placed[3] || corners[3]), - (connected[4] || placed[4] || corners[4]), - (connected[5] || placed[5] || corners[5]) - }; + renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]), + (connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) }; minX = Geometry.cable_low_offset; minY = (renderDir[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; minZ = (renderDir[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; @@ -389,21 +366,15 @@ public class SignalBus extends Block implements ITileEntityProvider { { connected = logic.connectedSides(ForgeDirection.EAST); corners = logic.getRenderCorners(ForgeDirection.EAST); - renderDir = new boolean[] { - (connected[0] || placed[0] || corners[0]), - (connected[1] || placed[1] || corners[1]), - (connected[2] || placed[2] || corners[2]), - (connected[3] || placed[3] || corners[3]), - (connected[4] || placed[4] || corners[4]), - (connected[5] || placed[5] || corners[5]) - }; + renderDir = new boolean[] { (connected[0] || placed[0] || corners[0]), (connected[1] || placed[1] || corners[1]), (connected[2] || placed[2] || corners[2]), + (connected[3] || placed[3] || corners[3]), (connected[4] || placed[4] || corners[4]), (connected[5] || placed[5] || corners[5]) }; minX = Geometry.cable_high_offset; minY = (renderDir[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; minZ = (renderDir[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_extend_min : Geometry.cable_width_min; maxX = Geometry.cable_high_height; maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; - + parts[5] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); didRender = true; } @@ -415,7 +386,7 @@ public class SignalBus extends Block implements ITileEntityProvider { maxX = Geometry.cable_width_max; maxY = Geometry.cable_low_height; maxZ = Geometry.cable_width_max; - + parts[0] = AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); } @@ -457,7 +428,7 @@ public class SignalBus extends Block implements ITileEntityProvider { /** * Draws lines for the edges of the bounding box. */ - private static void drawOutlinedBoundingBox(AxisAlignedBB par1AxisAlignedBB) + private static void drawOutlinedBoundingBox (AxisAlignedBB par1AxisAlignedBB) { Tessellator tessellator = Tessellator.instance; tessellator.startDrawing(3); @@ -485,21 +456,23 @@ public class SignalBus extends Block implements ITileEntityProvider { tessellator.addVertex(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ); tessellator.draw(); } - - @Override - public TileEntity createTileEntity(World world, int metadata) { - return new SignalBusLogic(); - } - @Override - public TileEntity createNewTileEntity(World world) { - return new SignalBusLogic(); - } - - @Override + @Override + public TileEntity createTileEntity (World world, int metadata) + { + return new SignalBusLogic(); + } + + @Override + public TileEntity createNewTileEntity (World world) + { + return new SignalBusLogic(); + } + + @Override public ArrayList getBlockDropped (World world, int x, int y, int z, int metadata, int fortune) { - return new ArrayList(); + return new ArrayList(); } @Override @@ -524,7 +497,7 @@ public class SignalBus extends Block implements ITileEntityProvider { float jumpX, jumpY, jumpZ; ItemStack tempStack; Random rand = new Random(); - + TileEntity te = world.getBlockTileEntity(x, y, z); if (te instanceof SignalBusLogic) { @@ -565,45 +538,34 @@ public class SignalBus extends Block implements ITileEntityProvider { super.breakBlock(world, x, y, z, id, meta); } - + /** * checks to see if you can place this block can be placed on that side of a block: BlockLever overrides */ @Override - public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) + public boolean canPlaceBlockOnSide (World par1World, int par2, int par3, int par4, int par5) { ForgeDirection dir = ForgeDirection.getOrientation(par5); - return (dir == DOWN && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN )) || - (dir == UP && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP )) || - (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) || - (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) || - (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST )) || - (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST )); + return (dir == DOWN && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN)) || (dir == UP && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP)) + || (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) || (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) + || (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) || (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)); } /** * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z */ @Override - public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) + public boolean canPlaceBlockAt (World par1World, int par2, int par3, int par4) { - return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) || - par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) || - par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) || - par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) || - par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP ) || - par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN ); + return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) || par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) || par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) + || par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) || par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) || par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN); } @Override public boolean canBlockStay (World par1World, int par2, int par3, int par4) { - return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) || - par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) || - par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) || - par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) || - par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP ) || - par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN ); + return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) || par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) || par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) + || par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) || par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) || par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN); } } diff --git a/src/tconstruct/blocks/SignalTerminal.java b/src/tconstruct/blocks/SignalTerminal.java index 3cf3b389..34679414 100644 --- a/src/tconstruct/blocks/SignalTerminal.java +++ b/src/tconstruct/blocks/SignalTerminal.java @@ -477,8 +477,6 @@ public class SignalTerminal extends Block implements ITileEntityProvider ((SignalTerminalLogic) te).connectPending(); } } - - @Override public ArrayList getBlockDropped (World world, int x, int y, int z, int metadata, int fortune) @@ -493,13 +491,13 @@ public class SignalTerminal extends Block implements ITileEntityProvider float jumpX, jumpY, jumpZ; ItemStack tempStack; Random rand = new Random(); - + TileEntity te = world.getBlockTileEntity(x, y, z); if (te instanceof SignalTerminalLogic) { dropTerm = ((SignalTerminalLogic) te).getDroppedTerminals(); dropWire = ((SignalTerminalLogic) te).getDroppedWire(); - + if (dropTerm > 0) { tempStack = new ItemStack(TConstruct.instance.content.signalTerminal.blockID, dropTerm, 0); diff --git a/src/tconstruct/blocks/SlimePad.java b/src/tconstruct/blocks/SlimePad.java index b4acb31b..116fbb25 100644 --- a/src/tconstruct/blocks/SlimePad.java +++ b/src/tconstruct/blocks/SlimePad.java @@ -26,21 +26,21 @@ public class SlimePad extends Block setBlockBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.625F, 0.875F); this.setCreativeTab(TConstructRegistry.blockTab); } - + @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z) { return null; } @Override - public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) + public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity) { if (!world.isBlockIndirectlyGettingPowered(x, y, z)) { double moveX = 0; double moveZ = 0; - + double speed = 0.25; int meta = world.getBlockMetadata(x, y, z); @@ -52,7 +52,7 @@ public class SlimePad extends Block case 7: moveX += speed; moveZ += speed; - break; + break; case 0: moveZ += speed; break; @@ -80,64 +80,66 @@ public class SlimePad extends Block { entity.posY += 1; } - entity.addVelocity(moveX, speed*2, moveZ); + entity.addVelocity(moveX, speed * 2, moveZ); world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, this.stepSound.getStepSound(), (this.stepSound.getVolume()) / 2.0F, this.stepSound.getPitch() * 0.65F); } } - - public boolean isBlockReplaceable(World world, int x, int y, int z) + + public boolean isBlockReplaceable (World world, int x, int y, int z) { return false; } @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) + public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) { int face = MathHelper.floor_double((double) (entity.rotationYaw * 8.0F / 360.0F) + 0.5D) + (entity.isSneaking() ? 4 : 0) & 7; int meta = world.getBlockMetadata(x, y, z) & 8; world.setBlockMetadataWithNotify(x, y, z, face | meta, 2); } - + @Override - public boolean renderAsNormalBlock() + public boolean renderAsNormalBlock () { return false; } @Override - public boolean isOpaqueCube() + public boolean isOpaqueCube () { return false; } @Override - public int getRenderBlockPass() + public int getRenderBlockPass () { return 1; } @Override - public int getRenderType() + public int getRenderType () { return SlimePadRender.model; } @Override - public void registerIcons(IconRegister iconRegister) {} + public void registerIcons (IconRegister iconRegister) + { + } @Override @SideOnly(Side.CLIENT) - public Icon getIcon(int side, int meta) + public Icon getIcon (int side, int meta) { return TContent.slimeGel.getIcon(side, 1); } - public Icon getFluidIcon(int meta) + public Icon getFluidIcon (int meta) { return TContent.slimeChannel.getIcon(2, 0); } - public Icon getNubIcon(int meta) + public Icon getNubIcon (int meta) { return TContent.slimeGel.getIcon(0, 0); } diff --git a/src/tconstruct/blocks/SoilBlock.java b/src/tconstruct/blocks/SoilBlock.java index 9b11e823..51063194 100644 --- a/src/tconstruct/blocks/SoilBlock.java +++ b/src/tconstruct/blocks/SoilBlock.java @@ -64,8 +64,8 @@ public class SoilBlock extends TConstructBlock return Block.dirt.blockHardness; return this.blockHardness; } - - public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + + public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z) { return Block.slowSand.getCollisionBoundingBoxFromPool(world, x, y, z); } diff --git a/src/tconstruct/blocks/StoneLadder.java b/src/tconstruct/blocks/StoneLadder.java index fe31026f..e02e2cfb 100644 --- a/src/tconstruct/blocks/StoneLadder.java +++ b/src/tconstruct/blocks/StoneLadder.java @@ -6,7 +6,8 @@ import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.util.Icon; -public class StoneLadder extends BlockLadder { +public class StoneLadder extends BlockLadder +{ // Override ladder material public final Material blockMaterial = Material.rock; @@ -22,13 +23,13 @@ public class StoneLadder extends BlockLadder { } @Override - public void registerIcons(IconRegister register) + public void registerIcons (IconRegister register) { icon = register.registerIcon("tinker:ladder_stone"); } @Override - public Icon getIcon(int meta, int side) + public Icon getIcon (int meta, int side) { return icon; } diff --git a/src/tconstruct/blocks/TConstructBlock.java b/src/tconstruct/blocks/TConstructBlock.java index 0a8b0ac5..f60d4685 100644 --- a/src/tconstruct/blocks/TConstructBlock.java +++ b/src/tconstruct/blocks/TConstructBlock.java @@ -50,7 +50,7 @@ public class TConstructBlock extends Block { return meta < icons.length ? icons[meta] : icons[0]; } - + @SideOnly(Side.CLIENT) public int getSideTextureIndex (int side) { diff --git a/src/tconstruct/blocks/TankAirBlock.java b/src/tconstruct/blocks/TankAirBlock.java index fbb2b331..0b3acecd 100644 --- a/src/tconstruct/blocks/TankAirBlock.java +++ b/src/tconstruct/blocks/TankAirBlock.java @@ -66,8 +66,8 @@ public class TankAirBlock extends BlockContainer return null; } - - public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 par5Vec3, Vec3 par6Vec3) + + public MovingObjectPosition collisionRayTrace (World world, int x, int y, int z, Vec3 par5Vec3, Vec3 par6Vec3) { TankAirLogic tank = (TankAirLogic) world.getBlockTileEntity(x, y, z); if (tank.hasItem()) @@ -89,17 +89,17 @@ public class TankAirBlock extends BlockContainer } @Override - public boolean canHarvestBlock(EntityPlayer player, int meta) + public boolean canHarvestBlock (EntityPlayer player, int meta) { return false; } - + @Override - public boolean isAirBlock(World world, int x, int y, int z) + public boolean isAirBlock (World world, int x, int y, int z) { return false; } - + @Override public void getSubBlocks (int id, CreativeTabs tab, List list) { diff --git a/src/tconstruct/blocks/WoodRail.java b/src/tconstruct/blocks/WoodRail.java index 0df899d0..897674ba 100644 --- a/src/tconstruct/blocks/WoodRail.java +++ b/src/tconstruct/blocks/WoodRail.java @@ -21,37 +21,35 @@ public class WoodRail extends BlockRailBase } @SideOnly(Side.CLIENT) - /** * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata */ - public Icon getIcon(int par1, int par2) + public Icon getIcon (int par1, int par2) { return par2 >= 6 ? this.theIcon : this.blockIcon; } @SideOnly(Side.CLIENT) - /** * When this method is called, your block should register all the icons it needs with the given IconRegister. This * is the only chance you get to register icons. */ - public void registerIcons(IconRegister par1IconRegister) + public void registerIcons (IconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("tinker:woodrail"); this.theIcon = par1IconRegister.registerIcon("tinker:woodrail_turn"); } - protected void func_94358_a(World par1World, int par2, int par3, int par4, int par5, int par6, int par7) + protected void func_94358_a (World par1World, int par2, int par3, int par4, int par5, int par6, int par7) { if (par7 > 0 && Block.blocksList[par7].canProvidePower() && (new BlockBaseRailLogic(this, par1World, par2, par3, par4)).getNumberOfAdjacentTracks() == 3) { this.refreshTrackShape(par1World, par2, par3, par4, false); } } - + @Override - public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) + public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, int z) { return 0.3f; } diff --git a/src/tconstruct/blocks/component/SignalBusMasterLogic.java b/src/tconstruct/blocks/component/SignalBusMasterLogic.java index cd0c5439..0e793fdd 100644 --- a/src/tconstruct/blocks/component/SignalBusMasterLogic.java +++ b/src/tconstruct/blocks/component/SignalBusMasterLogic.java @@ -123,7 +123,6 @@ public class SignalBusMasterLogic extends MultiblockMasterBaseLogic ((SignalBusMasterLogic) newMaster).forceUpdate(); - } @Override diff --git a/src/tconstruct/blocks/component/SmelteryComponent.java b/src/tconstruct/blocks/component/SmelteryComponent.java index de38c122..59790d01 100644 --- a/src/tconstruct/blocks/component/SmelteryComponent.java +++ b/src/tconstruct/blocks/component/SmelteryComponent.java @@ -258,7 +258,7 @@ public class SmelteryComponent extends LogicComponent ret = 1; return ret; } - + /* NBT */ public void readNetworkNBT (NBTTagCompound tags) { diff --git a/src/tconstruct/blocks/component/TankAirComponent.java b/src/tconstruct/blocks/component/TankAirComponent.java index b6d02407..703e9ac4 100644 --- a/src/tconstruct/blocks/component/TankAirComponent.java +++ b/src/tconstruct/blocks/component/TankAirComponent.java @@ -7,13 +7,16 @@ import tconstruct.library.component.MultiFluidTank; public class TankAirComponent extends MultiFluidTank { - public TankAirComponent() {} + public TankAirComponent() + { + } + public TankAirComponent(int i) { super(i); } - - public void overrideFluids(ArrayList fluids) + + public void overrideFluids (ArrayList fluids) { fluidlist = fluids; } diff --git a/src/tconstruct/blocks/logic/AdaptiveDrainLogic.java b/src/tconstruct/blocks/logic/AdaptiveDrainLogic.java index 820fae0d..4330d44f 100644 --- a/src/tconstruct/blocks/logic/AdaptiveDrainLogic.java +++ b/src/tconstruct/blocks/logic/AdaptiveDrainLogic.java @@ -29,7 +29,7 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl @Override public boolean setPotentialMaster (IMasterLogic master, World world, int x, int y, int z) { - // TConstruct.logger.info("Master: "+master); + // TConstruct.logger.info("Master: "+master); return (master instanceof AdaptiveSmelteryLogic || master instanceof AdaptiveDrainLogic) && !hasMaster; } @@ -47,11 +47,11 @@ public class AdaptiveDrainLogic extends MultiServantLogic implements IFluidHandl @Override public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain) { - // TConstruct.logger.info("Attempting drain " + hasValidMaster()); + // TConstruct.logger.info("Attempting drain " + hasValidMaster()); if (hasValidMaster() && canDrain(from, null)) { AdaptiveSmelteryLogic smeltery = (AdaptiveSmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z); - // TConstruct.logger.info("Found master"); + // TConstruct.logger.info("Found master"); return smeltery.drain(from, maxDrain, doDrain); } return null; diff --git a/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java b/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java index 3e3be126..365f239a 100644 --- a/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java +++ b/src/tconstruct/blocks/logic/AdaptiveSmelteryLogic.java @@ -82,7 +82,7 @@ public class AdaptiveSmelteryLogic extends AdaptiveInventoryLogic implements IAc updateAir(); updateAir = false; } - + if (recheckStructure) { structure.recheckStructure(); diff --git a/src/tconstruct/blocks/logic/AdvancedDrawbridgeLogic.java b/src/tconstruct/blocks/logic/AdvancedDrawbridgeLogic.java index 9f17b15c..088615f4 100644 --- a/src/tconstruct/blocks/logic/AdvancedDrawbridgeLogic.java +++ b/src/tconstruct/blocks/logic/AdvancedDrawbridgeLogic.java @@ -22,518 +22,620 @@ import tconstruct.library.blocks.*; import tconstruct.library.util.*; import tconstruct.util.player.FakePlayerLogic; -public class AdvancedDrawbridgeLogic extends InventoryLogic implements IFacingLogic, IActiveLogic, IDrawbridgeLogicBase { - boolean active; - boolean working; - int ticks; - public int selSlot = 0; - byte extension; - byte direction; - byte placementDirection = 4; - FakePlayerLogic fakePlayer; +public class AdvancedDrawbridgeLogic extends InventoryLogic implements IFacingLogic, IActiveLogic, IDrawbridgeLogicBase +{ + boolean active; + boolean working; + int ticks; + public int selSlot = 0; + byte extension; + byte direction; + byte placementDirection = 4; + FakePlayerLogic fakePlayer; - ItemStack[] bufferStacks = new ItemStack[getSizeInventory()]; + ItemStack[] bufferStacks = new ItemStack[getSizeInventory()]; - public InvCamo camoInventory = new InvCamo(); + public InvCamo camoInventory = new InvCamo(); - public AdvancedDrawbridgeLogic() { - super(16); - } - - @Override - public void setWorldObj(World par1World) { - this.worldObj = par1World; - fakePlayer = new FakePlayerLogic(worldObj, "Player.Drawbridge", this); - } - - @Override - public boolean getActive() { - return active; - } - - @Override - public void setActive(boolean flag) { - active = flag; - working = true; - } - - @Override - public byte getRenderDirection() { - return direction; - } - - @Override - public ForgeDirection getForgeDirection() { - return ForgeDirection.VALID_DIRECTIONS[direction]; - } - - @Override - public void setDirection(int side) { - } - - public boolean canDropInventorySlot(int slot) { - return false; - } - - @Override - public void setDirection(float yaw, float pitch, EntityLivingBase player) { - if (pitch > 45) { - direction = 1; - } else if (pitch < -45) { - direction = 0; - } else { - int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3; - switch (facing) { - case 0: - direction = 2; - break; - - case 1: - direction = 5; - break; - - case 2: - direction = 3; - break; - - case 3: - direction = 4; - break; - } - } - } - - /* - * 0 = Up 1 = Right 2 = Down 3 = Left 4 = Center, neutral - */ - public void setPlacementDirection(byte keycode) { - if (keycode == 4) { - fakePlayer.rotationYaw = 0; - fakePlayer.rotationPitch = 0; - } else if (this.direction == 0 || this.direction == 1) { - switch (keycode) { - case 0: - fakePlayer.rotationYaw = 0; - break; - case 1: - fakePlayer.rotationYaw = 90; - break; - case 2: - fakePlayer.rotationYaw = 180; - break; - case 3: - fakePlayer.rotationYaw = 270; - break; - } - - if (this.direction == 0) - fakePlayer.rotationPitch = -90; - else - fakePlayer.rotationPitch = 90; - } else { - if (keycode == 0) // Forward - { - fakePlayer.rotationYaw = mapDirection() * 90; - - if (keycode == 0) - fakePlayer.rotationPitch = 90; - else - fakePlayer.rotationPitch = -90; - } else if (keycode == 2) // Backward - { - int face = mapDirection() + 2; - if (face > 3) - face -= 4; - fakePlayer.rotationYaw = face * 90; - - if (keycode == 0) - fakePlayer.rotationPitch = 90; - else - fakePlayer.rotationPitch = -90; - } else { - fakePlayer.rotationPitch = 0; - - int facing = mapDirection(); - if (keycode == 1) - facing += 1; - else - facing -= 1; - - if (facing >= 4) - facing = 0; - if (facing < 0) - facing = 3; - - fakePlayer.rotationYaw = facing * 90; - } - } - placementDirection = keycode; - } - - int mapDirection() { - if (this.direction == 2) // North - return 0; - if (this.direction == 5) // East - return 1; - if (this.direction == 3) // South - return 2; - - return 3; // West - } - - public byte getPlacementDirection() { - return placementDirection; - } + public AdvancedDrawbridgeLogic() + { + super(16); + } @Override - public ItemStack getStackInSlot (int slot){ + public void setWorldObj (World par1World) + { + this.worldObj = par1World; + fakePlayer = new FakePlayerLogic(worldObj, "Player.Drawbridge", this); + } + + @Override + public boolean getActive () + { + return active; + } + + @Override + public void setActive (boolean flag) + { + active = flag; + working = true; + } + + @Override + public byte getRenderDirection () + { + return direction; + } + + @Override + public ForgeDirection getForgeDirection () + { + return ForgeDirection.VALID_DIRECTIONS[direction]; + } + + @Override + public void setDirection (int side) + { + } + + public boolean canDropInventorySlot (int slot) + { + return false; + } + + @Override + public void setDirection (float yaw, float pitch, EntityLivingBase player) + { + if (pitch > 45) + { + direction = 1; + } + else if (pitch < -45) + { + direction = 0; + } + else + { + int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3; + switch (facing) + { + case 0: + direction = 2; + break; + + case 1: + direction = 5; + break; + + case 2: + direction = 3; + break; + + case 3: + direction = 4; + break; + } + } + } + + /* + * 0 = Up 1 = Right 2 = Down 3 = Left 4 = Center, neutral + */ + public void setPlacementDirection (byte keycode) + { + if (keycode == 4) + { + fakePlayer.rotationYaw = 0; + fakePlayer.rotationPitch = 0; + } + else if (this.direction == 0 || this.direction == 1) + { + switch (keycode) + { + case 0: + fakePlayer.rotationYaw = 0; + break; + case 1: + fakePlayer.rotationYaw = 90; + break; + case 2: + fakePlayer.rotationYaw = 180; + break; + case 3: + fakePlayer.rotationYaw = 270; + break; + } + + if (this.direction == 0) + fakePlayer.rotationPitch = -90; + else + fakePlayer.rotationPitch = 90; + } + else + { + if (keycode == 0) // Forward + { + fakePlayer.rotationYaw = mapDirection() * 90; + + if (keycode == 0) + fakePlayer.rotationPitch = 90; + else + fakePlayer.rotationPitch = -90; + } + else if (keycode == 2) // Backward + { + int face = mapDirection() + 2; + if (face > 3) + face -= 4; + fakePlayer.rotationYaw = face * 90; + + if (keycode == 0) + fakePlayer.rotationPitch = 90; + else + fakePlayer.rotationPitch = -90; + } + else + { + fakePlayer.rotationPitch = 0; + + int facing = mapDirection(); + if (keycode == 1) + facing += 1; + else + facing -= 1; + + if (facing >= 4) + facing = 0; + if (facing < 0) + facing = 3; + + fakePlayer.rotationYaw = facing * 90; + } + } + placementDirection = keycode; + } + + int mapDirection () + { + if (this.direction == 2) // North + return 0; + if (this.direction == 5) // East + return 1; + if (this.direction == 3) // South + return 2; + + return 3; // West + } + + public byte getPlacementDirection () + { + return placementDirection; + } + + @Override + public ItemStack getStackInSlot (int slot) + { return slot < inventory.length ? inventory[slot] : null; } - - public ItemStack getStackInBufferSlot(int slot) { - return slot < bufferStacks.length ? bufferStacks[slot] : null; - } - public void setBufferSlotContents(int slot, ItemStack itemstack) { - if (slot < bufferStacks.length) { - bufferStacks[slot] = itemstack; - } else { - return; - } - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z) { - return new AdvancedDrawbridgeContainer(inventoryplayer, this); - } + public ItemStack getStackInBufferSlot (int slot) + { + return slot < bufferStacks.length ? bufferStacks[slot] : null; + } - @Override - protected String getDefaultName() { - return "tinker.drawbridge"; - } + public void setBufferSlotContents (int slot, ItemStack itemstack) + { + if (slot < bufferStacks.length) + { + bufferStacks[slot] = itemstack; + } + else + { + return; + } + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + { + itemstack.stackSize = getInventoryStackLimit(); + } + } - @Override - public ItemStack decrStackSize(int slot, int quantity) { - ItemStack stack = super.decrStackSize(slot, quantity); - if (slot == 1) - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - return stack; - } + @Override + public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z) + { + return new AdvancedDrawbridgeContainer(inventoryplayer, this); + } - public void updateEntity() { - if (working) { - ticks++; - if (ticks == 5) { - ticks = 0; - if (active) // Placement - { - if (getStackInSlot(extension) != null && getStackInSlot(extension).stackSize > 0 && extension < 15) { - extension++; - int xPos = xCoord; - int yPos = yCoord; - int zPos = zCoord; + @Override + protected String getDefaultName () + { + return "tinker.drawbridge"; + } - switch (direction) { - case 0: - yPos -= extension; - break; - case 1: - yPos += extension; - break; - case 2: - zPos -= extension; - break; - case 3: - zPos += extension; - break; - case 4: - xPos -= extension; - break; - case 5: - xPos += extension; - break; - } + @Override + public ItemStack decrStackSize (int slot, int quantity) + { + ItemStack stack = super.decrStackSize(slot, quantity); + if (slot == 1) + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + return stack; + } - Block block = Block.blocksList[worldObj.getBlockId(xPos, yPos, zPos)]; - if (block == null || block.isAirBlock(worldObj, xPos, yPos, zPos) || block.isBlockReplaceable(worldObj, xPos, yPos, zPos)) { - // tryExtend(worldObj, xPos, yPos, zPos, direction); - int blockToItem = getStackInBufferSlot(extension - 1) != null ? TConstructRegistry.blockToItemMapping[getStackInBufferSlot(extension - 1).itemID] : 0; - if (blockToItem == 0) { - if (getStackInSlot(extension - 1) == null || getStackInSlot(extension - 1).itemID >= 4096 || Block.blocksList[getStackInSlot(extension - 1).itemID] == null) - return; - Block placeBlock = Block.blocksList[getStackInBufferSlot(extension - 1).itemID]; - placeBlockAt(getStackInSlot(extension - 1), fakePlayer, worldObj, xPos, yPos, zPos, direction, 0, 0, 0, getStackInSlot(extension - 1).getItemDamage(), placeBlock); - } else { - Block placeBlock = Block.blocksList[blockToItem]; - placeBlockAt(getStackInSlot(extension - 1), fakePlayer, worldObj, xPos, yPos, zPos, direction, 0, 0, 0, getStackInSlot(extension - 1).getItemDamage(), placeBlock); - } - worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "tile.piston.out", 0.25F, worldObj.rand.nextFloat() * 0.25F + 0.6F); - decrStackSize(extension - 1, 1); - } else { - extension--; - working = false; - } - } else { - working = false; - } - } else - // Retraction - { - if ((getStackInSlot(extension) == null || getStackInSlot(extension).stackSize < getStackInSlot(extension).getMaxStackSize()) && extension > 0) { - int xPos = xCoord; - int yPos = yCoord; - int zPos = zCoord; + public void updateEntity () + { + if (working) + { + ticks++; + if (ticks == 5) + { + ticks = 0; + if (active) // Placement + { + if (getStackInSlot(extension) != null && getStackInSlot(extension).stackSize > 0 && extension < 15) + { + extension++; + int xPos = xCoord; + int yPos = yCoord; + int zPos = zCoord; - switch (direction) { - case 0: - yPos -= extension; - break; - case 1: - yPos += extension; - break; - case 2: - zPos -= extension; - break; - case 3: - zPos += extension; - break; - case 4: - xPos -= extension; - break; - case 5: - xPos += extension; - break; - } + switch (direction) + { + case 0: + yPos -= extension; + break; + case 1: + yPos += extension; + break; + case 2: + zPos -= extension; + break; + case 3: + zPos += extension; + break; + case 4: + xPos -= extension; + break; + case 5: + xPos += extension; + break; + } - Block block = Block.blocksList[worldObj.getBlockId(xPos, yPos, zPos)]; - if (block != null) { - int meta = worldObj.getBlockMetadata(xPos, yPos, zPos); - if (getStackInBufferSlot(extension - 1) != null && validBlock(extension - 1, block) && validMetadata(extension - 1, block.blockID, meta)) { - worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "tile.piston.in", 0.25F, worldObj.rand.nextFloat() * 0.15F + 0.6F); - if (worldObj.setBlock(xPos, yPos, zPos, 0)) - if (getStackInSlot(extension - 1) == null) { - setInventorySlotContents(extension - 1, getStackInBufferSlot(extension - 1).copy()); - } else { - getStackInSlot(extension - 1).stackSize++; - } - } else { - working = false; - } - } - extension--; - } else { - working = false; - } - } - } - } - } + Block block = Block.blocksList[worldObj.getBlockId(xPos, yPos, zPos)]; + if (block == null || block.isAirBlock(worldObj, xPos, yPos, zPos) || block.isBlockReplaceable(worldObj, xPos, yPos, zPos)) + { + // tryExtend(worldObj, xPos, yPos, zPos, direction); + int blockToItem = getStackInBufferSlot(extension - 1) != null ? TConstructRegistry.blockToItemMapping[getStackInBufferSlot(extension - 1).itemID] : 0; + if (blockToItem == 0) + { + if (getStackInSlot(extension - 1) == null || getStackInSlot(extension - 1).itemID >= 4096 || Block.blocksList[getStackInSlot(extension - 1).itemID] == null) + return; + Block placeBlock = Block.blocksList[getStackInBufferSlot(extension - 1).itemID]; + placeBlockAt(getStackInSlot(extension - 1), fakePlayer, worldObj, xPos, yPos, zPos, direction, 0, 0, 0, getStackInSlot(extension - 1).getItemDamage(), placeBlock); + } + else + { + Block placeBlock = Block.blocksList[blockToItem]; + placeBlockAt(getStackInSlot(extension - 1), fakePlayer, worldObj, xPos, yPos, zPos, direction, 0, 0, 0, getStackInSlot(extension - 1).getItemDamage(), placeBlock); + } + worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "tile.piston.out", 0.25F, worldObj.rand.nextFloat() * 0.25F + 0.6F); + decrStackSize(extension - 1, 1); + } + else + { + extension--; + working = false; + } + } + else + { + working = false; + } + } + else + // Retraction + { + if ((getStackInSlot(extension) == null || getStackInSlot(extension).stackSize < getStackInSlot(extension).getMaxStackSize()) && extension > 0) + { + int xPos = xCoord; + int yPos = yCoord; + int zPos = zCoord; - /** - * Called to actually place the block, after the location is determined and - * all permission checks have been made. Copied from ItemBlock - * - * @param stack - * The item stack that was used to place the block. This can be - * changed inside the method. - * @param player - * The player who is placing the block. Can be null if the block - * is not being placed by a player. - * @param side - * The side the player (or machine) right-clicked on. - */ - public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata, Block block) { - if (!world.setBlock(x, y, z, block.blockID, metadata, 3)) { - return false; - } + switch (direction) + { + case 0: + yPos -= extension; + break; + case 1: + yPos += extension; + break; + case 2: + zPos -= extension; + break; + case 3: + zPos += extension; + break; + case 4: + xPos -= extension; + break; + case 5: + xPos += extension; + break; + } - if (world.getBlockId(x, y, z) == block.blockID) { - block.onBlockPlacedBy(world, x, y, z, player, stack); - block.onPostBlockPlaced(world, x, y, z, metadata); - } + Block block = Block.blocksList[worldObj.getBlockId(xPos, yPos, zPos)]; + if (block != null) + { + int meta = worldObj.getBlockMetadata(xPos, yPos, zPos); + if (getStackInBufferSlot(extension - 1) != null && validBlock(extension - 1, block) && validMetadata(extension - 1, block.blockID, meta)) + { + worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "tile.piston.in", 0.25F, worldObj.rand.nextFloat() * 0.15F + 0.6F); + if (worldObj.setBlock(xPos, yPos, zPos, 0)) + if (getStackInSlot(extension - 1) == null) + { + setInventorySlotContents(extension - 1, getStackInBufferSlot(extension - 1).copy()); + } + else + { + getStackInSlot(extension - 1).stackSize++; + } + } + else + { + working = false; + } + } + extension--; + } + else + { + working = false; + } + } + } + } + } - return true; - } + /** + * Called to actually place the block, after the location is determined and + * all permission checks have been made. Copied from ItemBlock + * + * @param stack + * The item stack that was used to place the block. This can be + * changed inside the method. + * @param player + * The player who is placing the block. Can be null if the block + * is not being placed by a player. + * @param side + * The side the player (or machine) right-clicked on. + */ + public boolean placeBlockAt (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata, Block block) + { + if (!world.setBlock(x, y, z, block.blockID, metadata, 3)) + { + return false; + } - boolean validBlock(int slot, Block block) { - int type = TConstructRegistry.interchangableBlockMapping[block.blockID]; - if (type != 0) { - if (type == getStackInBufferSlot(slot).itemID) - return true; - } - int blockToItem = TConstructRegistry.blockToItemMapping[block.blockID]; - if (blockToItem != 0) { - if (blockToItem == getStackInBufferSlot(slot).itemID) - return true; - } - return block.blockID == getStackInBufferSlot(slot).itemID; - } + if (world.getBlockId(x, y, z) == block.blockID) + { + block.onBlockPlacedBy(world, x, y, z, player, stack); + block.onPostBlockPlaced(world, x, y, z, metadata); + } - boolean validMetadata(int slot, int blockID, int metadata) { - int type = TConstructRegistry.drawbridgeState[blockID]; - if (type == 0) { - return metadata == getStackInBufferSlot(slot).getItemDamage(); - } - if (type == 1) { - return true; - } - if (type == 2) { - return false; - } - if (type == 3) { - return true; // TODO: rotational metadata, probably not needed - // anymore - } - if (type == 4) { - return true; - } - if (type == 5) { - return metadata == getStackInBufferSlot(slot).getItemDamage(); - } - return false; - } + return true; + } - @Override - public void readFromNBT(NBTTagCompound tags) { - super.readFromNBT(tags); - active = tags.getBoolean("Active"); - working = tags.getBoolean("Working"); - extension = tags.getByte("Extension"); + boolean validBlock (int slot, Block block) + { + int type = TConstructRegistry.interchangableBlockMapping[block.blockID]; + if (type != 0) + { + if (type == getStackInBufferSlot(slot).itemID) + return true; + } + int blockToItem = TConstructRegistry.blockToItemMapping[block.blockID]; + if (blockToItem != 0) + { + if (blockToItem == getStackInBufferSlot(slot).itemID) + return true; + } + return block.blockID == getStackInBufferSlot(slot).itemID; + } - NBTTagCompound camoTag = (NBTTagCompound) tags.getTag("Camo"); - if (camoTag != null) { - camoInventory.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(camoTag)); - } + boolean validMetadata (int slot, int blockID, int metadata) + { + int type = TConstructRegistry.drawbridgeState[blockID]; + if (type == 0) + { + return metadata == getStackInBufferSlot(slot).getItemDamage(); + } + if (type == 1) + { + return true; + } + if (type == 2) + { + return false; + } + if (type == 3) + { + return true; // TODO: rotational metadata, probably not needed + // anymore + } + if (type == 4) + { + return true; + } + if (type == 5) + { + return metadata == getStackInBufferSlot(slot).getItemDamage(); + } + return false; + } - readBufferFromNBT(tags); - readCustomNBT(tags); - } + @Override + public void readFromNBT (NBTTagCompound tags) + { + super.readFromNBT(tags); + active = tags.getBoolean("Active"); + working = tags.getBoolean("Working"); + extension = tags.getByte("Extension"); - @Override - public void writeToNBT(NBTTagCompound tags) { - super.writeToNBT(tags); - tags.setBoolean("Active", active); - tags.setBoolean("Working", working); - tags.setByte("Extension", extension); + NBTTagCompound camoTag = (NBTTagCompound) tags.getTag("Camo"); + if (camoTag != null) + { + camoInventory.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(camoTag)); + } - if (camoInventory.getStackInSlot(0) != null) { - NBTTagCompound camoTag = new NBTTagCompound(); - camoInventory.getStackInSlot(0).writeToNBT(camoTag); - tags.setTag("Camo", camoTag); - } + readBufferFromNBT(tags); + readCustomNBT(tags); + } - writeBufferToNBT(tags); - writeCustomNBT(tags); - } + @Override + public void writeToNBT (NBTTagCompound tags) + { + super.writeToNBT(tags); + tags.setBoolean("Active", active); + tags.setBoolean("Working", working); + tags.setByte("Extension", extension); - public void readBufferFromNBT(NBTTagCompound tags) { - NBTTagList nbttaglist = tags.getTagList("Buffer"); - bufferStacks = new ItemStack[getSizeInventory()]; -// bufferStacks.ensureCapacity(nbttaglist.tagCount() > getSizeInventory() ? getSizeInventory() : nbttaglist.tagCount()); - for (int iter = 0; iter < nbttaglist.tagCount(); iter++) { - NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter); - byte slotID = tagList.getByte("Slot"); - if (slotID >= 0 && slotID < bufferStacks.length) { - setBufferSlotContents(slotID, ItemStack.loadItemStackFromNBT(tagList)); - } - } - } + if (camoInventory.getStackInSlot(0) != null) + { + NBTTagCompound camoTag = new NBTTagCompound(); + camoInventory.getStackInSlot(0).writeToNBT(camoTag); + tags.setTag("Camo", camoTag); + } - public void writeBufferToNBT(NBTTagCompound tags) { - NBTTagList nbttaglist = new NBTTagList(); - for (int iter = 0; iter < bufferStacks.length; iter++) { - if (getStackInBufferSlot(iter) != null) { - NBTTagCompound tagList = new NBTTagCompound(); - tagList.setByte("Slot", (byte) iter); - getStackInBufferSlot(iter).writeToNBT(tagList); - nbttaglist.appendTag(tagList); - } - } + writeBufferToNBT(tags); + writeCustomNBT(tags); + } - tags.setTag("Buffer", nbttaglist); - } + public void readBufferFromNBT (NBTTagCompound tags) + { + NBTTagList nbttaglist = tags.getTagList("Buffer"); + bufferStacks = new ItemStack[getSizeInventory()]; + // bufferStacks.ensureCapacity(nbttaglist.tagCount() > getSizeInventory() ? getSizeInventory() : nbttaglist.tagCount()); + for (int iter = 0; iter < nbttaglist.tagCount(); iter++) + { + NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter); + byte slotID = tagList.getByte("Slot"); + if (slotID >= 0 && slotID < bufferStacks.length) + { + setBufferSlotContents(slotID, ItemStack.loadItemStackFromNBT(tagList)); + } + } + } - public void readCustomNBT(NBTTagCompound tags) { - direction = tags.getByte("Direction"); - placementDirection = tags.getByte("Placement"); - } + public void writeBufferToNBT (NBTTagCompound tags) + { + NBTTagList nbttaglist = new NBTTagList(); + for (int iter = 0; iter < bufferStacks.length; iter++) + { + if (getStackInBufferSlot(iter) != null) + { + NBTTagCompound tagList = new NBTTagCompound(); + tagList.setByte("Slot", (byte) iter); + getStackInBufferSlot(iter).writeToNBT(tagList); + nbttaglist.appendTag(tagList); + } + } - public void writeCustomNBT(NBTTagCompound tags) { - tags.setByte("Direction", direction); - tags.setByte("Placement", placementDirection); - } + tags.setTag("Buffer", nbttaglist); + } - /* Packets */ - @Override - public Packet getDescriptionPacket() { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag); - } + public void readCustomNBT (NBTTagCompound tags) + { + direction = tags.getByte("Direction"); + placementDirection = tags.getByte("Placement"); + } - @Override - public void onDataPacket(INetworkManager net, Packet132TileEntityData packet) { - readFromNBT(packet.data); - worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); - } + public void writeCustomNBT (NBTTagCompound tags) + { + tags.setByte("Direction", direction); + tags.setByte("Placement", placementDirection); + } - public boolean hasExtended() { - return extension != 0; - } + /* Packets */ + @Override + public Packet getDescriptionPacket () + { + NBTTagCompound tag = new NBTTagCompound(); + writeToNBT(tag); + return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag); + } - @Override - public void onInventoryChanged() { - super.onInventoryChanged(); - for (int i = 0; i < getSizeInventory(); i++) { - if (getStackInSlot(i) != null) { - setBufferSlotContents(i, getStackInSlot(i).copy()); - getStackInBufferSlot(i).stackSize = 1; - } - } - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } + @Override + public void onDataPacket (INetworkManager net, Packet132TileEntityData packet) + { + readFromNBT(packet.data); + worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); + } -// @Override -// public int getMaxSize() { -// return 16; -// } + public boolean hasExtended () + { + return extension != 0; + } - @Override - public int getInventoryStackLimit() { - return 1; - } + @Override + public void onInventoryChanged () + { + super.onInventoryChanged(); + for (int i = 0; i < getSizeInventory(); i++) + { + if (getStackInSlot(i) != null) + { + setBufferSlotContents(i, getStackInSlot(i).copy()); + getStackInBufferSlot(i).stackSize = 1; + } + } + this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } - public class InvCamo extends InventoryBasic { + // @Override + // public int getMaxSize() { + // return 16; + // } - private InvCamo() { - super("camoSlot", false, 1); - } + @Override + public int getInventoryStackLimit () + { + return 1; + } - public ItemStack getCamoStack() { - return this.getStackInSlot(0); - } + public class InvCamo extends InventoryBasic + { - @Override - public void setInventorySlotContents(int slot, ItemStack content) { - super.setInventorySlotContents(slot, content); - if (slot == 0 && worldObj != null) - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } + private InvCamo() + { + super("camoSlot", false, 1); + } - @Override - public void onInventoryChanged() { - super.onInventoryChanged(); - if(worldObj != null){ - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - } - - @Override - public int getInventoryStackLimit(){ - return 1; - } - } + public ItemStack getCamoStack () + { + return this.getStackInSlot(0); + } + + @Override + public void setInventorySlotContents (int slot, ItemStack content) + { + super.setInventorySlotContents(slot, content); + if (slot == 0 && worldObj != null) + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + + @Override + public void onInventoryChanged () + { + super.onInventoryChanged(); + if (worldObj != null) + { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + } + + @Override + public int getInventoryStackLimit () + { + return 1; + } + } } diff --git a/src/tconstruct/blocks/logic/CraftingStationLogic.java b/src/tconstruct/blocks/logic/CraftingStationLogic.java index f4e6dc36..8a54edd8 100644 --- a/src/tconstruct/blocks/logic/CraftingStationLogic.java +++ b/src/tconstruct/blocks/logic/CraftingStationLogic.java @@ -36,18 +36,21 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent return true; } - @Override - public int[] getAccessibleSlotsFromSide(int var1) { - return new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9}; - } + @Override + public int[] getAccessibleSlotsFromSide (int var1) + { + return new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + } - @Override - public boolean canInsertItem(int i, ItemStack itemstack, int j) { - return i != 0; - } + @Override + public boolean canInsertItem (int i, ItemStack itemstack, int j) + { + return i != 0; + } - @Override - public boolean canExtractItem(int i, ItemStack itemstack, int j) { - return i != 0; - } + @Override + public boolean canExtractItem (int i, ItemStack itemstack, int j) + { + return i != 0; + } } diff --git a/src/tconstruct/blocks/logic/DrawbridgeLogic.java b/src/tconstruct/blocks/logic/DrawbridgeLogic.java index 10772114..39ee9263 100644 --- a/src/tconstruct/blocks/logic/DrawbridgeLogic.java +++ b/src/tconstruct/blocks/logic/DrawbridgeLogic.java @@ -30,14 +30,14 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc byte direction; byte placementDirection = 4; FakePlayerLogic fakePlayer; - + ItemStack bufferStack = null; public DrawbridgeLogic() { super(2); } - + @Override public void setWorldObj (World par1World) { @@ -260,7 +260,7 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc bufferStack = inventory[0].copy(); bufferStack.stackSize = 1; - + switch (direction) { case 0: @@ -354,10 +354,13 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc { worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "tile.piston.in", 0.25F, worldObj.rand.nextFloat() * 0.15F + 0.6F); if (worldObj.setBlock(xPos, yPos, zPos, 0)) - if(inventory[0] == null){ - inventory[0] = bufferStack.copy(); - }else{ - inventory[0].stackSize++; + if (inventory[0] == null) + { + inventory[0] = bufferStack.copy(); + } + else + { + inventory[0].stackSize++; } } else @@ -455,15 +458,17 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc active = tags.getBoolean("Active"); working = tags.getBoolean("Working"); extension = tags.getByte("Extension"); - + NBTTagCompound bufferInv = (NBTTagCompound) tags.getTag("BufferInv"); - if(bufferInv != null){ - bufferStack = ItemStack.loadItemStackFromNBT(bufferInv); + if (bufferInv != null) + { + bufferStack = ItemStack.loadItemStackFromNBT(bufferInv); } - if(bufferStack == null && inventory[0] != null){ - bufferStack = inventory[0]; + if (bufferStack == null && inventory[0] != null) + { + bufferStack = inventory[0]; } - + readCustomNBT(tags); } @@ -474,13 +479,14 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc tags.setBoolean("Active", active); tags.setBoolean("Working", working); tags.setByte("Extension", extension); - - if(bufferStack != null){ - NBTTagCompound bufferInv = new NBTTagCompound(); - bufferStack.writeToNBT(bufferInv); - tags.setTag("BufferInv", bufferInv); + + if (bufferStack != null) + { + NBTTagCompound bufferInv = new NBTTagCompound(); + bufferStack.writeToNBT(bufferInv); + tags.setTag("BufferInv", bufferInv); } - + writeCustomNBT(tags); } @@ -521,9 +527,10 @@ public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IAc public void onInventoryChanged () { super.onInventoryChanged(); - if(getStackInSlot(0) != null){ - bufferStack = getStackInSlot(0).copy(); - bufferStack.stackSize = 1; + if (getStackInSlot(0) != null) + { + bufferStack = getStackInSlot(0).copy(); + bufferStack.stackSize = 1; } this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } diff --git a/src/tconstruct/blocks/logic/EquipLogic.java b/src/tconstruct/blocks/logic/EquipLogic.java index 35bc7e00..05647e37 100644 --- a/src/tconstruct/blocks/logic/EquipLogic.java +++ b/src/tconstruct/blocks/logic/EquipLogic.java @@ -33,22 +33,26 @@ public abstract class EquipLogic extends InventoryLogic } @Override - public void setInventorySlotContents(int slot, ItemStack stack){ - if(slot == 0){ - return; - }else{ - super.setInventorySlotContents(slot, stack); - } + public void setInventorySlotContents (int slot, ItemStack stack) + { + if (slot == 0) + { + return; + } + else + { + super.setInventorySlotContents(slot, stack); + } } - + @Override - public ItemStack getStackInSlot(int slot) + public ItemStack getStackInSlot (int slot) { return slot != 0 ? inventory[slot] : null; } - - public boolean isStackInSlot(int slot) + + public boolean isStackInSlot (int slot) { - return slot != 0 ? inventory[slot] != null : false; + return slot != 0 ? inventory[slot] != null : false; } } diff --git a/src/tconstruct/blocks/logic/FurnaceLogic.java b/src/tconstruct/blocks/logic/FurnaceLogic.java index 40d63980..44b92a9d 100644 --- a/src/tconstruct/blocks/logic/FurnaceLogic.java +++ b/src/tconstruct/blocks/logic/FurnaceLogic.java @@ -215,7 +215,7 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin { return 150; } - + if (block == Block.wood) { return 1200; @@ -232,14 +232,22 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin } } - if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; - if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) return 200; - if (i == Item.stick.itemID) return 100; - if (i == Item.coal.itemID) return 1600; - if (i == Item.bucketLava.itemID) return 20000; - if (i == Block.sapling.blockID) return 100; - if (i == Item.blazeRod.itemID) return 2400; + if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) + return 200; + if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) + return 200; + if (item instanceof ItemHoe && ((ItemHoe) item).getMaterialName().equals("WOOD")) + return 200; + if (i == Item.stick.itemID) + return 100; + if (i == Item.coal.itemID) + return 1600; + if (i == Item.bucketLava.itemID) + return 20000; + if (i == Block.sapling.blockID) + return 100; + if (i == Item.blazeRod.itemID) + return 2400; return GameRegistry.getFuelValue(stack); } } diff --git a/src/tconstruct/blocks/logic/LandmineExplodeLogic.java b/src/tconstruct/blocks/logic/LandmineExplodeLogic.java index ea5741b4..e5dc6e45 100644 --- a/src/tconstruct/blocks/logic/LandmineExplodeLogic.java +++ b/src/tconstruct/blocks/logic/LandmineExplodeLogic.java @@ -17,111 +17,141 @@ import net.minecraft.world.World; * @author fuj1n * */ -public class LandmineExplodeLogic { +public class LandmineExplodeLogic +{ - private final World worldObj; - private final Entity triggerer; - private final TileEntityLandmine tileEntity; - private final int x, y, z; + private final World worldObj; + private final Entity triggerer; + private final TileEntityLandmine tileEntity; + private final int x, y, z; - public LandmineExplodeLogic(World par1World, int par2, int par3, int par4, Entity entity) { - worldObj = par1World; - this.tileEntity = (TileEntityLandmine) par1World.getBlockTileEntity(par2, par3, par4); - this.x = par2; - this.y = par3; - this.z = par4; - this.triggerer = entity; - } + public LandmineExplodeLogic(World par1World, int par2, int par3, int par4, Entity entity) + { + worldObj = par1World; + this.tileEntity = (TileEntityLandmine) par1World.getBlockTileEntity(par2, par3, par4); + this.x = par2; + this.y = par3; + this.z = par4; + this.triggerer = entity; + } - public void explode() { - if (triggerer == null) { - return; - } + public void explode () + { + if (triggerer == null) + { + return; + } - boolean preventExplode = false; - boolean isOffensive = true; - boolean cancelDefault = false; + boolean preventExplode = false; + boolean isOffensive = true; + boolean cancelDefault = false; - ArrayList stacks = new ArrayList(); - boolean hasExploded = false; + ArrayList stacks = new ArrayList(); + boolean hasExploded = false; - if (tileEntity == null) { - return; - } + if (tileEntity == null) + { + return; + } - tileEntity.isExploding = true; + tileEntity.isExploding = true; - for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++) { - ItemStack currentStack = tileEntity.getStackInSlot(i); - Behavior b = Behavior.getBehaviorFromStack(currentStack); - if (b != null) { + for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++) + { + ItemStack currentStack = tileEntity.getStackInSlot(i); + Behavior b = Behavior.getBehaviorFromStack(currentStack); + if (b != null) + { - if (b.doesBehaviorPreventRemovalOfBlock(currentStack)) { - preventExplode = true; - } + if (b.doesBehaviorPreventRemovalOfBlock(currentStack)) + { + preventExplode = true; + } - if (!b.isBehaviorExchangableWithOffensive(currentStack)) { - isOffensive = false; - } + if (!b.isBehaviorExchangableWithOffensive(currentStack)) + { + isOffensive = false; + } - if (b.overridesDefault()) { - cancelDefault = true; - } + if (b.overridesDefault()) + { + cancelDefault = true; + } - if (!stacks.isEmpty() && Behavior.arrayContainsEqualStack(stacks, currentStack) && b.effectStacks()) { - stacks.get(Behavior.arrayIndexOfStack(stacks, currentStack)).stackSize += currentStack.stackSize; - } else { - stacks.add(currentStack.copy()); - } - } - } + if (!stacks.isEmpty() && Behavior.arrayContainsEqualStack(stacks, currentStack) && b.effectStacks()) + { + stacks.get(Behavior.arrayIndexOfStack(stacks, currentStack)).stackSize += currentStack.stackSize; + } + else + { + stacks.add(currentStack.copy()); + } + } + } - LandmineSpecialStackLogic specialStacks = new LandmineSpecialStackLogic(worldObj, x, y, z, triggerer, isOffensive, stacks); - specialStacks.handleSpecialStacks(); + LandmineSpecialStackLogic specialStacks = new LandmineSpecialStackLogic(worldObj, x, y, z, triggerer, isOffensive, stacks); + specialStacks.handleSpecialStacks(); - Iterator i1 = stacks.iterator(); - while (i1.hasNext()) { - ItemStack currentStack = i1.next(); - Behavior b = Behavior.getBehaviorFromStack(currentStack); - if (b != null) { - if (isOffensive || !b.isOffensive(currentStack)) { - b.executeLogic(worldObj, x, y, z, currentStack, triggerer, !preventExplode); - if (b.shouldItemBeRemoved(currentStack, !preventExplode)) { - if (b.effectStacks()) { - for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++) { - if (tileEntity.getStackInSlot(i) != null) { - if (tileEntity.getStackInSlot(i).isItemEqual(currentStack)) { - tileEntity.setInventorySlotContents(i, null); - } - } - } - } else { - boolean hasRemoved = false; + Iterator i1 = stacks.iterator(); + while (i1.hasNext()) + { + ItemStack currentStack = i1.next(); + Behavior b = Behavior.getBehaviorFromStack(currentStack); + if (b != null) + { + if (isOffensive || !b.isOffensive(currentStack)) + { + b.executeLogic(worldObj, x, y, z, currentStack, triggerer, !preventExplode); + if (b.shouldItemBeRemoved(currentStack, !preventExplode)) + { + if (b.effectStacks()) + { + for (int i = 0; i < tileEntity.getSizeTriggerInventory(); i++) + { + if (tileEntity.getStackInSlot(i) != null) + { + if (tileEntity.getStackInSlot(i).isItemEqual(currentStack)) + { + tileEntity.setInventorySlotContents(i, null); + } + } + } + } + else + { + boolean hasRemoved = false; - for (int i = 0; i < tileEntity.getSizeTriggerInventory() && !hasRemoved; i++) { - if (tileEntity.getStackInSlot(i) != null) { - if (tileEntity.getStackInSlot(i).isItemEqual(currentStack)) { - tileEntity.setInventorySlotContents(i, null); - hasRemoved = true; - } - } - } - } - } - } - } - } + for (int i = 0; i < tileEntity.getSizeTriggerInventory() && !hasRemoved; i++) + { + if (tileEntity.getStackInSlot(i) != null) + { + if (tileEntity.getStackInSlot(i).isItemEqual(currentStack)) + { + tileEntity.setInventorySlotContents(i, null); + hasRemoved = true; + } + } + } + } + } + } + } + } - Behavior defBeh = Behavior.getDefaulBehavior(); - if (defBeh != null && isOffensive && !cancelDefault) { - defBeh.executeLogic(worldObj, x, y, z, null, triggerer, !preventExplode); - } + Behavior defBeh = Behavior.getDefaulBehavior(); + if (defBeh != null && isOffensive && !cancelDefault) + { + defBeh.executeLogic(worldObj, x, y, z, null, triggerer, !preventExplode); + } - if (hasExploded || defBeh != null && !preventExplode) { - worldObj.removeBlockTileEntity(x, y, z); - worldObj.setBlockToAir(x, y, z); - } else { - tileEntity.isExploding = false; - } - } + if (hasExploded || defBeh != null && !preventExplode) + { + worldObj.removeBlockTileEntity(x, y, z); + worldObj.setBlockToAir(x, y, z); + } + else + { + tileEntity.isExploding = false; + } + } } diff --git a/src/tconstruct/blocks/logic/MultiServantLogic.java b/src/tconstruct/blocks/logic/MultiServantLogic.java index cbe72dab..33c66849 100644 --- a/src/tconstruct/blocks/logic/MultiServantLogic.java +++ b/src/tconstruct/blocks/logic/MultiServantLogic.java @@ -29,7 +29,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic if (worldObj.getBlockId(master.x, master.y, master.z) == masterID && worldObj.getBlockMetadata(master.x, master.y, master.z) == masterMeat) return true; - + else { hasMaster = false; diff --git a/src/tconstruct/blocks/logic/SignalBusLogic.java b/src/tconstruct/blocks/logic/SignalBusLogic.java index 4ef74476..7db39e94 100644 --- a/src/tconstruct/blocks/logic/SignalBusLogic.java +++ b/src/tconstruct/blocks/logic/SignalBusLogic.java @@ -144,7 +144,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, { return; } - + if (forceCheck) { int connectableCount = this.getNeighboringMembers().length; @@ -153,7 +153,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, { cachedConnectableCount = connectableCount; super.onBlockAdded(worldObj, xCoord, yCoord, zCoord); -// this.getMultiblockMaster().revisitBlocks(); + // this.getMultiblockMaster().revisitBlocks(); } } @@ -286,8 +286,8 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, transceivers.put(coords, signals); northboundSignalsChanged = true; - - updateLocalSignals(((SignalBusMasterLogic)getMultiblockMaster()).getSignals()); + + updateLocalSignals(((SignalBusMasterLogic) getMultiblockMaster()).getSignals()); ((ISignalTransceiver) te).receiveSignalUpdate(cachedReceivedSignals); return true; } @@ -311,8 +311,8 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, if (transceivers != null || !transceivers.isEmpty()) { northboundSignalsChanged = true; - - updateLocalSignals(((SignalBusMasterLogic)getMultiblockMaster()).getSignals()); + + updateLocalSignals(((SignalBusMasterLogic) getMultiblockMaster()).getSignals()); } } @@ -566,14 +566,14 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, int i, j; ForgeDirection iDir, jDir; TileEntity te; - + for (i = 0; i < 6; ++i) { iDir = ForgeDirection.VALID_DIRECTIONS[i]; if (!placedSides[i]) { continue; - } + } for (j = 0; j < 6; ++j) { @@ -585,7 +585,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, if (xCoord + jDir.offsetX == coord.x && yCoord + jDir.offsetY == coord.y && zCoord + jDir.offsetZ == coord.z) { te = worldObj.getBlockTileEntity(xCoord + jDir.offsetX, yCoord + jDir.offsetY, zCoord + jDir.offsetZ); - if (te instanceof ISignalBusConnectable && ((ISignalBusConnectable)te).connectableOnFace(iDir)) + if (te instanceof ISignalBusConnectable && ((ISignalBusConnectable) te).connectableOnFace(iDir)) { return true; } @@ -597,7 +597,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, if (xCoord + iDir.offsetX + jDir.offsetX == coord.x && yCoord + iDir.offsetY + jDir.offsetY == coord.y && zCoord + iDir.offsetZ + jDir.offsetZ == coord.z) { te = worldObj.getBlockTileEntity(xCoord + iDir.offsetX + jDir.offsetX, yCoord + iDir.offsetY + jDir.offsetY, zCoord + iDir.offsetZ + jDir.offsetZ); - if (te instanceof ISignalBusConnectable && ((ISignalBusConnectable)te).connectableOnCorner(iDir.getOpposite(), jDir.getOpposite())) + if (te instanceof ISignalBusConnectable && ((ISignalBusConnectable) te).connectableOnCorner(iDir.getOpposite(), jDir.getOpposite())) { return true; } @@ -658,7 +658,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, ++calc; } } - + return calc; } @@ -674,10 +674,10 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, calc += ((ISignalTransceiver) te).getDroppedWire(); } } - + return calc; } - + public void notifyBreak () { CoordTuple[] scan = new CoordTuple[transceivers.keySet().size()]; @@ -732,7 +732,7 @@ public class SignalBusLogic extends MultiblockBaseLogic implements IActiveLogic, ++dropCount; } } - + return dropCount; } diff --git a/src/tconstruct/blocks/logic/SignalTerminalLogic.java b/src/tconstruct/blocks/logic/SignalTerminalLogic.java index 737de15a..d85d34fe 100644 --- a/src/tconstruct/blocks/logic/SignalTerminalLogic.java +++ b/src/tconstruct/blocks/logic/SignalTerminalLogic.java @@ -77,7 +77,7 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive if (isRegistered) { doUpdate = true; - + } else { @@ -162,7 +162,7 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive pendingSide = -1; forceUpdateSide = true; } - + if (worldObj.isRemote) { return; @@ -552,7 +552,8 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive { continue; } - temp = worldObj.getIndirectPowerLevelTo(xCoord + offset[0] + Facing.offsetsXForSide[j], yCoord + offset[1] + Facing.offsetsYForSide[j], zCoord + offset[2] + Facing.offsetsZForSide[j], j); + temp = worldObj.getIndirectPowerLevelTo(xCoord + offset[0] + Facing.offsetsXForSide[j], yCoord + offset[1] + Facing.offsetsYForSide[j], zCoord + offset[2] + + Facing.offsetsZForSide[j], j); if (temp > power) { @@ -578,8 +579,8 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive } else { - tempStrength = worldObj.getIndirectPowerLevelTo(xCoord + offset[0], yCoord + offset[1], zCoord + offset[2], oSide); -// tempStrength = worldObj.getStrongestIndirectPower(xCoord + offset[0], yCoord + offset[1], zCoord + offset[2]); + tempStrength = worldObj.getIndirectPowerLevelTo(xCoord + offset[0], yCoord + offset[1], zCoord + offset[2], oSide); + // tempStrength = worldObj.getStrongestIndirectPower(xCoord + offset[0], yCoord + offset[1], zCoord + offset[2]); } // if (tempStrength > 0 && tempStrength < receivingSides[i]){ @@ -617,20 +618,19 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive public int doUnregister (boolean reHoming) { int dropWire = 0; - + if (signalBus != null) { TileEntity te = worldObj.getBlockTileEntity(signalBus.x, signalBus.y, signalBus.z); dropWire = Math.abs(xCoord - signalBus.x) + Math.abs(yCoord - signalBus.y) + Math.abs(zCoord - signalBus.z); if (te instanceof SignalBusLogic) { - ((SignalBusLogic)te).unregisterTerminal(worldObj, xCoord, yCoord, zCoord); + ((SignalBusLogic) te).unregisterTerminal(worldObj, xCoord, yCoord, zCoord); } } // Remove signalBus coords signalBus = null; - // Calculate new local received signals and provide them to local connections receiveSignalUpdate(getReceivedSignals()); @@ -654,10 +654,10 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive ++count; } } - + return count; } - + public int getDroppedWire () { int calcWire = 0; @@ -666,7 +666,7 @@ public class SignalTerminalLogic extends TileEntity implements ISignalTransceive calcWire += Math.abs(signalBus.x - xCoord); calcWire += Math.abs(signalBus.y - yCoord); calcWire += Math.abs(signalBus.z - zCoord); - + return calcWire; } return 0; diff --git a/src/tconstruct/blocks/logic/TankAirLogic.java b/src/tconstruct/blocks/logic/TankAirLogic.java index 6f1dfc8e..9d4f9e13 100644 --- a/src/tconstruct/blocks/logic/TankAirLogic.java +++ b/src/tconstruct/blocks/logic/TankAirLogic.java @@ -30,19 +30,19 @@ public class TankAirLogic extends InventoryLogic implements IServantLogic, ISide { super(1); } - - public void overrideFluids(ArrayList fluids) + + public void overrideFluids (ArrayList fluids) { /*multitank.overrideFluids(fluids); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);*/ } - - public boolean hasItem() + + public boolean hasItem () { return inventory[0] != null; } - - public boolean hasFluids() + + public boolean hasFluids () { return multitank.fluidlist.size() > 0; } @@ -51,7 +51,7 @@ public class TankAirLogic extends InventoryLogic implements IServantLogic, ISide { return multitank.fluidlist; } - + @Override public void setInventorySlotContents (int slot, ItemStack itemstack) { @@ -127,27 +127,27 @@ public class TankAirLogic extends InventoryLogic implements IServantLogic, ISide { return false; } - + /*@Override public boolean canUpdate() { return false; }*/ - + //DELETE public void updateEntity () { worldObj.setBlockToAir(xCoord, yCoord, zCoord); } - + //Keep TE regardless of metadata - public boolean shouldRefresh(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z) + public boolean shouldRefresh (int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z) { return oldID != newID; } - + /* NBT */ - + @Override public void readFromNBT (NBTTagCompound tags) { diff --git a/src/tconstruct/blocks/slime/SlimeLeaves.java b/src/tconstruct/blocks/slime/SlimeLeaves.java index 0a980e2d..df4ed85b 100644 --- a/src/tconstruct/blocks/slime/SlimeLeaves.java +++ b/src/tconstruct/blocks/slime/SlimeLeaves.java @@ -82,9 +82,9 @@ public class SlimeLeaves extends BlockLeaves list.add(new ItemStack(id, 1, iter)); } } - + @Override - public boolean isLeaves(World world, int x, int y, int z) + public boolean isLeaves (World world, int x, int y, int z) { return true; } diff --git a/src/tconstruct/client/SignalTetherWorldOverlayRenderer.java b/src/tconstruct/client/SignalTetherWorldOverlayRenderer.java index 324d7932..86328ee6 100644 --- a/src/tconstruct/client/SignalTetherWorldOverlayRenderer.java +++ b/src/tconstruct/client/SignalTetherWorldOverlayRenderer.java @@ -34,85 +34,85 @@ public class SignalTetherWorldOverlayRenderer { GL11.glPushMatrix(); Entity entity = event.context.mc.renderViewEntity; - + double posX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * event.partialTicks; double posY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * event.partialTicks; double posZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * event.partialTicks; GL11.glTranslated(-posX, -posY, -posZ); - + GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_LIGHTING); GL11.glLineWidth(2.5F); GL11.glBegin(GL11.GL_LINES); - + GL11.glColor4f(1, 0, 0, 1); World world = entity.worldObj; int x1 = (int) entity.posX; int z1 = (int) entity.posZ; - int y1 = (int) ((entity.posY > world.getHeight()-16) ? world.getHeight()-16 : ((entity.posY < 16) ? 16 : entity.posY)); + int y1 = (int) ((entity.posY > world.getHeight() - 16) ? world.getHeight() - 16 : ((entity.posY < 16) ? 16 : entity.posY)); AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0); - + GL11.glColor4f(1, 0, 0, 1); - + Chunk chunks[] = new Chunk[9]; - + chunks[4] = world.getChunkFromBlockCoords(x1, z1); int cX = chunks[4].xPosition; int cZ = chunks[4].zPosition; - + chunks[0] = world.getChunkFromChunkCoords(cX - 1, cZ - 1); - chunks[1] = world.getChunkFromChunkCoords(cX , cZ - 1); + chunks[1] = world.getChunkFromChunkCoords(cX, cZ - 1); chunks[2] = world.getChunkFromChunkCoords(cX + 1, cZ - 1); - - chunks[3] = world.getChunkFromChunkCoords(cX - 1, cZ ); - chunks[5] = world.getChunkFromChunkCoords(cX + 1, cZ ); - + + chunks[3] = world.getChunkFromChunkCoords(cX - 1, cZ); + chunks[5] = world.getChunkFromChunkCoords(cX + 1, cZ); + chunks[6] = world.getChunkFromChunkCoords(cX - 1, cZ + 1); - chunks[7] = world.getChunkFromChunkCoords(cX , cZ + 1); + chunks[7] = world.getChunkFromChunkCoords(cX, cZ + 1); chunks[8] = world.getChunkFromChunkCoords(cX + 1, cZ + 1); - + Queue transceivers = new LinkedList(); CoordTuple src; CoordTuple dst; for (int c = 0; c < 9; ++c) { - for(Object obj : chunks[c].chunkTileEntityMap.values()) + for (Object obj : chunks[c].chunkTileEntityMap.values()) { if (obj instanceof ISignalTransceiver && obj instanceof TileEntity) { dst = ((ISignalTransceiver) obj).getBusCoords(); if (dst != null) { - src = new CoordTuple(((TileEntity)obj).xCoord, ((TileEntity)obj).yCoord, ((TileEntity)obj).zCoord); - transceivers.add(new CoordTuplePair(src,dst)); + src = new CoordTuple(((TileEntity) obj).xCoord, ((TileEntity) obj).yCoord, ((TileEntity) obj).zCoord); + transceivers.add(new CoordTuplePair(src, dst)); } } } } - + CoordTuplePair renderPair; while (transceivers.size() > 0) { renderPair = transceivers.remove(); - + GL11.glVertex3d(renderPair.a.x + 0.5, renderPair.a.y + 0.5, renderPair.a.z + 0.5); GL11.glVertex3d(renderPair.b.x + 0.5, renderPair.b.y, renderPair.b.z + 0.5); } -// GL11.glVertex3d(x, y+0.004, z); -// GL11.glVertex3d(x+1, y+0.004, z+1); -// GL11.glVertex3d(x+1, y+0.004, z); -// GL11.glVertex3d(x, y+0.004, z+1); + // GL11.glVertex3d(x, y+0.004, z); + // GL11.glVertex3d(x+1, y+0.004, z+1); + // GL11.glVertex3d(x+1, y+0.004, z); + // GL11.glVertex3d(x, y+0.004, z+1); GL11.glEnd(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); - + GL11.glPopMatrix(); } } diff --git a/src/tconstruct/client/TClientEvents.java b/src/tconstruct/client/TClientEvents.java index 700c5eb6..1f34fb44 100644 --- a/src/tconstruct/client/TClientEvents.java +++ b/src/tconstruct/client/TClientEvents.java @@ -62,7 +62,7 @@ public class TClientEvents { TContent.fluids[i].setIcons(TContent.fluidBlocks[i].getIcon(0, 0), TContent.fluidBlocks[i].getIcon(2, 0)); } - + Fluid lava = FluidRegistry.getFluid("lava"); lava.setIcons(Block.lavaStill.getIcon(0, 0), Block.lavaStill.getIcon(2, 0)); Fluid lavawater = FluidRegistry.getFluid("water"); diff --git a/src/tconstruct/client/TClientTickHandler.java b/src/tconstruct/client/TClientTickHandler.java index 69b8782f..9f68378a 100644 --- a/src/tconstruct/client/TClientTickHandler.java +++ b/src/tconstruct/client/TClientTickHandler.java @@ -26,7 +26,6 @@ public class TClientTickHandler implements ITickHandler TContent.oreBerry.setGraphicsLevel(Block.leaves.graphicsLevel); TContent.oreBerrySecond.setGraphicsLevel(Block.leaves.graphicsLevel); TContent.slimeLeaves.setGraphicsLevel(Block.leaves.graphicsLevel); - /*if (PHConstruct.alphaHunger) { diff --git a/src/tconstruct/client/armor/RenderArmorCast.java b/src/tconstruct/client/armor/RenderArmorCast.java index d103f728..8eeefe65 100644 --- a/src/tconstruct/client/armor/RenderArmorCast.java +++ b/src/tconstruct/client/armor/RenderArmorCast.java @@ -15,217 +15,232 @@ import net.minecraft.util.Icon; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.common.ForgeDirection; -public class RenderArmorCast implements IItemRenderer { +public class RenderArmorCast implements IItemRenderer +{ - @Override - public boolean handleRenderType(ItemStack item, ItemRenderType type) { - return type != ItemRenderType.FIRST_PERSON_MAP; - } + @Override + public boolean handleRenderType (ItemStack item, ItemRenderType type) + { + return type != ItemRenderType.FIRST_PERSON_MAP; + } - @Override - public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { - switch (helper) { - case BLOCK_3D: - return true; - case ENTITY_BOBBING: - return true; - case ENTITY_ROTATION: - return true; - case EQUIPPED_BLOCK: - return true; - case INVENTORY_BLOCK: - return true; - default: - return false; - } - } + @Override + public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper) + { + switch (helper) + { + case BLOCK_3D: + return true; + case ENTITY_BOBBING: + return true; + case ENTITY_ROTATION: + return true; + case EQUIPPED_BLOCK: + return true; + case INVENTORY_BLOCK: + return true; + default: + return false; + } + } - @Override - public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - RenderBlocks renderer = Minecraft.getMinecraft().renderGlobal.globalRenderBlocks; - Tessellator tessellator = Tessellator.instance; - Icon baseIcon = item.getItem() instanceof ArmorPattern ? ((ArmorPattern) item.getItem()).getBaseIcon() : item.getIconIndex(); - GL11.glPushMatrix(); - switch (type) { - case ENTITY: - GL11.glScalef(0.8F, 0.33F, 0.8F); - GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - break; - case INVENTORY: - GL11.glScalef(1F, 0.6F, 1F); - GL11.glTranslatef(0F, -0.1F, 0F); - break; - case EQUIPPED: - GL11.glScalef(1F, 0.6F, 1F); - break; - case EQUIPPED_FIRST_PERSON: - GL11.glScalef(1F, 0.6F, 1F); - break; - default: - break; - } - renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F); - renderCube(tessellator, renderer, baseIcon); - renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 1.0F, 0.9F); - ArrayList sides = new ArrayList(); - sides.add(ForgeDirection.NORTH); - sides.add(ForgeDirection.SOUTH); - sides.add(ForgeDirection.EAST); - sides.add(ForgeDirection.WEST); - renderSelectedCube(tessellator, renderer, baseIcon, sides); - renderCastTop(item, type); + @Override + public void renderItem (ItemRenderType type, ItemStack item, Object... data) + { + RenderBlocks renderer = Minecraft.getMinecraft().renderGlobal.globalRenderBlocks; + Tessellator tessellator = Tessellator.instance; + Icon baseIcon = item.getItem() instanceof ArmorPattern ? ((ArmorPattern) item.getItem()).getBaseIcon() : item.getIconIndex(); + GL11.glPushMatrix(); + switch (type) + { + case ENTITY: + GL11.glScalef(0.8F, 0.33F, 0.8F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + break; + case INVENTORY: + GL11.glScalef(1F, 0.6F, 1F); + GL11.glTranslatef(0F, -0.1F, 0F); + break; + case EQUIPPED: + GL11.glScalef(1F, 0.6F, 1F); + break; + case EQUIPPED_FIRST_PERSON: + GL11.glScalef(1F, 0.6F, 1F); + break; + default: + break; + } + renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F); + renderCube(tessellator, renderer, baseIcon); + renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 1.0F, 0.9F); + ArrayList sides = new ArrayList(); + sides.add(ForgeDirection.NORTH); + sides.add(ForgeDirection.SOUTH); + sides.add(ForgeDirection.EAST); + sides.add(ForgeDirection.WEST); + renderSelectedCube(tessellator, renderer, baseIcon, sides); + renderCastTop(item, type); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - public void renderCube(Tessellator tessellator, RenderBlocks renderer, Icon icon) { - tessellator.startDrawingQuads(); - tessellator.setNormal(-1F, 0F, 0F); - renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(1F, 0F, 0F); - renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(0F, -1F, 0F); - renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(0F, 1F, 0F); - renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(0F, 0F, -1F); - renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(0F, 0F, 1F); - renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon); - tessellator.draw(); - } + public void renderCube (Tessellator tessellator, RenderBlocks renderer, Icon icon) + { + tessellator.startDrawingQuads(); + tessellator.setNormal(-1F, 0F, 0F); + renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(1F, 0F, 0F); + renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(0F, -1F, 0F); + renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(0F, 1F, 0F); + renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(0F, 0F, -1F); + renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(0F, 0F, 1F); + renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon); + tessellator.draw(); + } - public void renderSelectedCube(Tessellator tessellator, RenderBlocks renderer, Icon icon, List sidesToRender) { - tessellator.startDrawingQuads(); - tessellator.setNormal(-1F, 0F, 0F); - if (sidesToRender.contains(ForgeDirection.WEST)) - renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(1F, 0F, 0F); - if (sidesToRender.contains(ForgeDirection.EAST)) - renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(0F, -1F, 0F); - if (sidesToRender.contains(ForgeDirection.DOWN)) - renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(0F, 1F, 0F); - if (sidesToRender.contains(ForgeDirection.UP)) - renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(0F, 0F, -1F); - if (sidesToRender.contains(ForgeDirection.SOUTH)) - renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon); - tessellator.setNormal(0F, 0F, 1F); - if (sidesToRender.contains(ForgeDirection.NORTH)) - renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon); - tessellator.draw(); - } + public void renderSelectedCube (Tessellator tessellator, RenderBlocks renderer, Icon icon, List sidesToRender) + { + tessellator.startDrawingQuads(); + tessellator.setNormal(-1F, 0F, 0F); + if (sidesToRender.contains(ForgeDirection.WEST)) + renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(1F, 0F, 0F); + if (sidesToRender.contains(ForgeDirection.EAST)) + renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(0F, -1F, 0F); + if (sidesToRender.contains(ForgeDirection.DOWN)) + renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(0F, 1F, 0F); + if (sidesToRender.contains(ForgeDirection.UP)) + renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(0F, 0F, -1F); + if (sidesToRender.contains(ForgeDirection.SOUTH)) + renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon); + tessellator.setNormal(0F, 0F, 1F); + if (sidesToRender.contains(ForgeDirection.NORTH)) + renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon); + tessellator.draw(); + } - public void renderCastTop(ItemStack par1ItemStack, ItemRenderType type) { - GL11.glPushMatrix(); - Icon icon = par1ItemStack.getIconIndex(); + public void renderCastTop (ItemStack par1ItemStack, ItemRenderType type) + { + GL11.glPushMatrix(); + Icon icon = par1ItemStack.getIconIndex(); - if (icon == null) { - GL11.glPopMatrix(); - return; - } - TextureManager texturemanager = Minecraft.getMinecraft().renderEngine; - texturemanager.bindTexture(texturemanager.getResourceLocation(par1ItemStack.getItemSpriteNumber())); - Tessellator tessellator = Tessellator.instance; - float f = icon.getMinU(); - float f1 = icon.getMaxU(); - float f2 = icon.getMinV(); - float f3 = icon.getMaxV(); - float f4 = 0.0F; - float f5 = 0.3F; - GL11.glTranslatef(-f4, -f5, 0.0F); - float f6 = 1.5F; - GL11.glRotatef(90F, 90F, 0F, 0F); - GL11.glScalef(0.9F, 0.9F, 2F); - GL11.glTranslatef(0.05F, 0.05F, -0.6F); - renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - GL11.glScalef(0.8F, 0.8F, 0.9F); - GL11.glTranslatef(0.125F, 0.125F, 0.05F); - renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - GL11.glScalef(0.6F, 0.6F, 0.6F); - GL11.glTranslatef(0.335F, 0.335F, 0.05F); - renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); + if (icon == null) + { + GL11.glPopMatrix(); + return; + } + TextureManager texturemanager = Minecraft.getMinecraft().renderEngine; + texturemanager.bindTexture(texturemanager.getResourceLocation(par1ItemStack.getItemSpriteNumber())); + Tessellator tessellator = Tessellator.instance; + float f = icon.getMinU(); + float f1 = icon.getMaxU(); + float f2 = icon.getMinV(); + float f3 = icon.getMaxV(); + float f4 = 0.0F; + float f5 = 0.3F; + GL11.glTranslatef(-f4, -f5, 0.0F); + float f6 = 1.5F; + GL11.glRotatef(90F, 90F, 0F, 0F); + GL11.glScalef(0.9F, 0.9F, 2F); + GL11.glTranslatef(0.05F, 0.05F, -0.6F); + renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); + GL11.glScalef(0.8F, 0.8F, 0.9F); + GL11.glTranslatef(0.125F, 0.125F, 0.05F); + renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); + GL11.glScalef(0.6F, 0.6F, 0.6F); + GL11.glTranslatef(0.335F, 0.335F, 0.05F); + renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); - GL11.glPopMatrix(); - } + GL11.glPopMatrix(); + } - public static void renderItemIn2D(Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5, float par6, float par7) { - par0Tessellator.startDrawingQuads(); - par0Tessellator.setNormal(0.0F, 0.0F, 1.0F); - par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4); - par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) par3, (double) par4); - par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) par3, (double) par2); - par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) par1, (double) par2); - par0Tessellator.draw(); - par0Tessellator.startDrawingQuads(); - par0Tessellator.setNormal(0.0F, 0.0F, -1.0F); - par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double) (0.0F - par7), (double) par1, (double) par2); - par0Tessellator.addVertexWithUV(1.0D, 1.0D, (double) (0.0F - par7), (double) par3, (double) par2); - par0Tessellator.addVertexWithUV(1.0D, 0.0D, (double) (0.0F - par7), (double) par3, (double) par4); - par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double) (0.0F - par7), (double) par1, (double) par4); - par0Tessellator.draw(); - float f5 = 0.5F * (par1 - par3) / (float) par5; - float f6 = 0.5F * (par4 - par2) / (float) par6; - par0Tessellator.startDrawingQuads(); - par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F); - int k; - float f7; - float f8; + public static void renderItemIn2D (Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5, float par6, float par7) + { + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(0.0F, 0.0F, 1.0F); + par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4); + par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) par3, (double) par4); + par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) par3, (double) par2); + par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) par1, (double) par2); + par0Tessellator.draw(); + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(0.0F, 0.0F, -1.0F); + par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double) (0.0F - par7), (double) par1, (double) par2); + par0Tessellator.addVertexWithUV(1.0D, 1.0D, (double) (0.0F - par7), (double) par3, (double) par2); + par0Tessellator.addVertexWithUV(1.0D, 0.0D, (double) (0.0F - par7), (double) par3, (double) par4); + par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double) (0.0F - par7), (double) par1, (double) par4); + par0Tessellator.draw(); + float f5 = 0.5F * (par1 - par3) / (float) par5; + float f6 = 0.5F * (par4 - par2) / (float) par6; + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F); + int k; + float f7; + float f8; - for (k = 0; k < par5; ++k) { - f7 = (float) k / (float) par5; - f8 = par1 + (par3 - par1) * f7 - f5; - par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4); - par0Tessellator.addVertexWithUV((double) f7, 0.0D, 0.0D, (double) f8, (double) par4); - par0Tessellator.addVertexWithUV((double) f7, 1.0D, 0.0D, (double) f8, (double) par2); - par0Tessellator.addVertexWithUV((double) f7, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2); - } + for (k = 0; k < par5; ++k) + { + f7 = (float) k / (float) par5; + f8 = par1 + (par3 - par1) * f7 - f5; + par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4); + par0Tessellator.addVertexWithUV((double) f7, 0.0D, 0.0D, (double) f8, (double) par4); + par0Tessellator.addVertexWithUV((double) f7, 1.0D, 0.0D, (double) f8, (double) par2); + par0Tessellator.addVertexWithUV((double) f7, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2); + } - par0Tessellator.draw(); - par0Tessellator.startDrawingQuads(); - par0Tessellator.setNormal(1.0F, 0.0F, 0.0F); - float f9; + par0Tessellator.draw(); + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(1.0F, 0.0F, 0.0F); + float f9; - for (k = 0; k < par5; ++k) { - f7 = (float) k / (float) par5; - f8 = par1 + (par3 - par1) * f7 - f5; - f9 = f7 + 1.0F / (float) par5; - par0Tessellator.addVertexWithUV((double) f9, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2); - par0Tessellator.addVertexWithUV((double) f9, 1.0D, 0.0D, (double) f8, (double) par2); - par0Tessellator.addVertexWithUV((double) f9, 0.0D, 0.0D, (double) f8, (double) par4); - par0Tessellator.addVertexWithUV((double) f9, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4); - } + for (k = 0; k < par5; ++k) + { + f7 = (float) k / (float) par5; + f8 = par1 + (par3 - par1) * f7 - f5; + f9 = f7 + 1.0F / (float) par5; + par0Tessellator.addVertexWithUV((double) f9, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2); + par0Tessellator.addVertexWithUV((double) f9, 1.0D, 0.0D, (double) f8, (double) par2); + par0Tessellator.addVertexWithUV((double) f9, 0.0D, 0.0D, (double) f8, (double) par4); + par0Tessellator.addVertexWithUV((double) f9, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4); + } - par0Tessellator.draw(); - par0Tessellator.startDrawingQuads(); - par0Tessellator.setNormal(0.0F, 1.0F, 0.0F); + par0Tessellator.draw(); + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(0.0F, 1.0F, 0.0F); - for (k = 0; k < par6; ++k) { - f7 = (float) k / (float) par6; - f8 = par4 + (par2 - par4) * f7 - f6; - f9 = f7 + 1.0F / (float) par6; - par0Tessellator.addVertexWithUV(0.0D, (double) f9, 0.0D, (double) par1, (double) f8); - par0Tessellator.addVertexWithUV(1.0D, (double) f9, 0.0D, (double) par3, (double) f8); - par0Tessellator.addVertexWithUV(1.0D, (double) f9, (double) (0.0F - par7), (double) par3, (double) f8); - par0Tessellator.addVertexWithUV(0.0D, (double) f9, (double) (0.0F - par7), (double) par1, (double) f8); - } + for (k = 0; k < par6; ++k) + { + f7 = (float) k / (float) par6; + f8 = par4 + (par2 - par4) * f7 - f6; + f9 = f7 + 1.0F / (float) par6; + par0Tessellator.addVertexWithUV(0.0D, (double) f9, 0.0D, (double) par1, (double) f8); + par0Tessellator.addVertexWithUV(1.0D, (double) f9, 0.0D, (double) par3, (double) f8); + par0Tessellator.addVertexWithUV(1.0D, (double) f9, (double) (0.0F - par7), (double) par3, (double) f8); + par0Tessellator.addVertexWithUV(0.0D, (double) f9, (double) (0.0F - par7), (double) par1, (double) f8); + } - par0Tessellator.draw(); - par0Tessellator.startDrawingQuads(); - par0Tessellator.setNormal(0.0F, -1.0F, 0.0F); + par0Tessellator.draw(); + par0Tessellator.startDrawingQuads(); + par0Tessellator.setNormal(0.0F, -1.0F, 0.0F); - for (k = 0; k < par6; ++k) { - f7 = (float) k / (float) par6; - f8 = par4 + (par2 - par4) * f7 - f6; - par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8); - par0Tessellator.addVertexWithUV(0.0D, (double) f7, 0.0D, (double) par1, (double) f8); - par0Tessellator.addVertexWithUV(0.0D, (double) f7, (double) (0.0F - par7), (double) par1, (double) f8); - par0Tessellator.addVertexWithUV(1.0D, (double) f7, (double) (0.0F - par7), (double) par3, (double) f8); - } + for (k = 0; k < par6; ++k) + { + f7 = (float) k / (float) par6; + f8 = par4 + (par2 - par4) * f7 - f6; + par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8); + par0Tessellator.addVertexWithUV(0.0D, (double) f7, 0.0D, (double) par1, (double) f8); + par0Tessellator.addVertexWithUV(0.0D, (double) f7, (double) (0.0F - par7), (double) par1, (double) f8); + par0Tessellator.addVertexWithUV(1.0D, (double) f7, (double) (0.0F - par7), (double) par3, (double) f8); + } - par0Tessellator.draw(); - } + par0Tessellator.draw(); + } } \ No newline at end of file diff --git a/src/tconstruct/client/block/CastingBasinSpecialRender.java b/src/tconstruct/client/block/CastingBasinSpecialRender.java index 22d3456d..f198008f 100644 --- a/src/tconstruct/client/block/CastingBasinSpecialRender.java +++ b/src/tconstruct/client/block/CastingBasinSpecialRender.java @@ -53,12 +53,14 @@ public class CastingBasinSpecialRender extends TileEntitySpecialRenderer { GL11.glScalef(1.6F, 1.6F, 1.6F); GL11.glTranslatef(0F, 0.045F, 0.0f); - } else if (!(stack.getItem() instanceof ItemBlocklike)) { - GL11.glRotatef(90F, 1F, 0F, 0F); - GL11.glRotatef(90F, 0F, 0F, 1F); - GL11.glScalef(0.75F, 0.75F, 0.75F); - GL11.glTranslatef(0F, -0.235F, -0.36F); - } + } + else if (!(stack.getItem() instanceof ItemBlocklike)) + { + GL11.glRotatef(90F, 1F, 0F, 0F); + GL11.glRotatef(90F, 0F, 0F, 1F); + GL11.glScalef(0.75F, 0.75F, 0.75F); + GL11.glTranslatef(0F, -0.235F, -0.36F); + } RenderItem.renderInFrame = true; RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F); diff --git a/src/tconstruct/client/block/PaneConnectedRender.java b/src/tconstruct/client/block/PaneConnectedRender.java index a143db4f..737595cb 100644 --- a/src/tconstruct/client/block/PaneConnectedRender.java +++ b/src/tconstruct/client/block/PaneConnectedRender.java @@ -14,77 +14,87 @@ import tconstruct.blocks.GlassPaneConnected; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; -public class PaneConnectedRender implements ISimpleBlockRenderingHandler { +public class PaneConnectedRender implements ISimpleBlockRenderingHandler +{ - public static int model = RenderingRegistry.getNextAvailableRenderId(); + public static int model = RenderingRegistry.getNextAvailableRenderId(); - @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + @Override + public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) + { - } + } - @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - boolean temp = renderer.renderAllFaces; - renderer.renderAllFaces = true; - - GlassPaneConnected pane = (GlassPaneConnected)block; - - boolean flag = pane.canPaneConnectTo(world, x, y, z, EAST); - boolean flag1 = pane.canPaneConnectTo(world, x, y, z, WEST); - boolean flag2 = pane.canPaneConnectTo(world, x, y, z, SOUTH); - boolean flag3 = pane.canPaneConnectTo(world, x, y, z, NORTH); - - Icon sideTexture = pane.getSideTextureIndex(); - - if(!flag && !flag1 && !flag2 && !flag3){ - renderer.setRenderBounds(0D, 0D, 0.45D, 1D, 1D, 0.55D); - renderer.renderStandardBlock(block, x, y, z); - renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 1D); - renderer.renderStandardBlock(block, x, y, z); - }else{ -// renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 0.55D); -// renderer.renderStandardBlock(block, x, y, z); - } - -// renderer.setOverrideBlockTexture(sideTexture); - - if(flag){ - renderer.setRenderBounds(0.45D, 0D, 0.45D, 1D, 1D, 0.55D); - renderer.renderStandardBlock(block, x, y, z); - } - - if(flag1){ - renderer.setRenderBounds(0D, 0D, 0.45D, 0.45D, 1D, 0.55D); - renderer.renderStandardBlock(block, x, y, z); - } - - if(flag2){ - renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 1D); - renderer.renderStandardBlock(block, x, y, z); - } - - if(flag3){ - renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 0.45D); - renderer.renderStandardBlock(block, x, y, z); - } - - - - renderer.clearOverrideBlockTexture(); - - renderer.renderAllFaces = false; - return true; - } + @Override + public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) + { + boolean temp = renderer.renderAllFaces; + renderer.renderAllFaces = true; - @Override - public boolean shouldRender3DInInventory() { - return false; - } + GlassPaneConnected pane = (GlassPaneConnected) block; - @Override - public int getRenderId() { - return model; - } + boolean flag = pane.canPaneConnectTo(world, x, y, z, EAST); + boolean flag1 = pane.canPaneConnectTo(world, x, y, z, WEST); + boolean flag2 = pane.canPaneConnectTo(world, x, y, z, SOUTH); + boolean flag3 = pane.canPaneConnectTo(world, x, y, z, NORTH); + + Icon sideTexture = pane.getSideTextureIndex(); + + if (!flag && !flag1 && !flag2 && !flag3) + { + renderer.setRenderBounds(0D, 0D, 0.45D, 1D, 1D, 0.55D); + renderer.renderStandardBlock(block, x, y, z); + renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 1D); + renderer.renderStandardBlock(block, x, y, z); + } + else + { + // renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 0.55D); + // renderer.renderStandardBlock(block, x, y, z); + } + + // renderer.setOverrideBlockTexture(sideTexture); + + if (flag) + { + renderer.setRenderBounds(0.45D, 0D, 0.45D, 1D, 1D, 0.55D); + renderer.renderStandardBlock(block, x, y, z); + } + + if (flag1) + { + renderer.setRenderBounds(0D, 0D, 0.45D, 0.45D, 1D, 0.55D); + renderer.renderStandardBlock(block, x, y, z); + } + + if (flag2) + { + renderer.setRenderBounds(0.45D, 0D, 0.45D, 0.55D, 1D, 1D); + renderer.renderStandardBlock(block, x, y, z); + } + + if (flag3) + { + renderer.setRenderBounds(0.45D, 0D, 0D, 0.55D, 1D, 0.45D); + renderer.renderStandardBlock(block, x, y, z); + } + + renderer.clearOverrideBlockTexture(); + + renderer.renderAllFaces = false; + return true; + } + + @Override + public boolean shouldRender3DInInventory () + { + return false; + } + + @Override + public int getRenderId () + { + return model; + } } diff --git a/src/tconstruct/client/block/SignalBusRender.java b/src/tconstruct/client/block/SignalBusRender.java index 20bcc60e..7da5c8f1 100644 --- a/src/tconstruct/client/block/SignalBusRender.java +++ b/src/tconstruct/client/block/SignalBusRender.java @@ -46,13 +46,14 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler for (int i = 0; i < 6; ++i) { - if (!placedSides[i]){ + if (!placedSides[i]) + { continue; } didRender = true; connectedSides = tile.connectedSides(ForgeDirection.getOrientation(i)); corners = tile.getRenderCorners(ForgeDirection.getOrientation(i)); - + renderFaceWithConnections(renderer, block, x, y, z, i, placedSides, connectedSides, corners); } if (!didRender) @@ -63,7 +64,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler double maxX = Geometry.cable_width_max; double maxY = Geometry.cable_low_height; double maxZ = Geometry.cable_width_max; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -80,16 +81,10 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler double maxX = 1D; double maxY = 1D; double maxZ = 1D; - - boolean[] renderDir = { - (connectedSides[0] || placed[0] || corners[0]), - (connectedSides[1] || placed[1] || corners[1]), - (connectedSides[2] || placed[2] || corners[2]), - (connectedSides[3] || placed[3] || corners[3]), - (connectedSides[4] || placed[4] || corners[4]), - (connectedSides[5] || placed[5] || corners[5]) - }; - + + boolean[] renderDir = { (connectedSides[0] || placed[0] || corners[0]), (connectedSides[1] || placed[1] || corners[1]), (connectedSides[2] || placed[2] || corners[2]), + (connectedSides[3] || placed[3] || corners[3]), (connectedSides[4] || placed[4] || corners[4]), (connectedSides[5] || placed[5] || corners[5]) }; + switch (side) { case 0: // DOWN @@ -102,15 +97,15 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxY = Geometry.cable_low_height; maxZ = Geometry.cable_width_max; - + maxY += Geometry.zfight; - + minX = (corners[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_corner_min : minX; maxX = (corners[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_corner_max : maxX; - + renderer.setRenderBounds(minX, minY, minZ, Geometry.cable_width_min, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(Geometry.cable_width_max, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -123,13 +118,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_width_max; maxY = Geometry.cable_low_height; maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; - + minZ = (corners[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_corner_min : minZ; maxZ = (corners[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_corner_max : maxZ; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, Geometry.cable_width_min); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(minX, minY, Geometry.cable_width_max, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -140,7 +135,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_width_max; maxY = Geometry.cable_low_height; maxZ = Geometry.cable_width_max; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); @@ -155,15 +150,15 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxY = Geometry.cable_high_height; maxZ = Geometry.cable_width_max; - + minY -= Geometry.zfight; - + minX = (corners[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_corner_min : minX; maxX = (corners[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_corner_max : maxX; - + renderer.setRenderBounds(minX, minY, minZ, Geometry.cable_width_min, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(Geometry.cable_width_max, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -176,13 +171,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_width_max; maxY = Geometry.cable_high_height; maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; - + minZ = (corners[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_corner_min : minZ; maxZ = (corners[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_corner_max : maxZ; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, Geometry.cable_width_min); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(minX, minY, Geometry.cable_width_max, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -193,10 +188,10 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_width_max; maxY = Geometry.cable_high_height; maxZ = Geometry.cable_width_max; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + break; case 2: // NORTH // Render East/West @@ -208,13 +203,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxY = Geometry.cable_width_max; maxZ = Geometry.cable_low_height; - + minX = (corners[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_corner_min : minX; maxX = (corners[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_corner_max : maxX; - + renderer.setRenderBounds(minX, minY, minZ, Geometry.cable_width_min, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(Geometry.cable_width_max, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -227,13 +222,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_width_max; maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxZ = Geometry.cable_low_height; - + minY += (placed[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_low_height : 0; - maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0; - + maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0; + renderer.setRenderBounds(minX, Geometry.cable_width_max, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(minX, minY, minZ, maxX, Geometry.cable_width_min, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -244,7 +239,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_width_max; maxY = Geometry.cable_width_max; maxZ = Geometry.cable_low_height; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); @@ -259,13 +254,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = (renderDir[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxY = Geometry.cable_width_max; maxZ = Geometry.cable_high_height; - + minX = (corners[ForgeDirection.WEST.ordinal()]) ? Geometry.cable_corner_min : minX; maxX = (corners[ForgeDirection.EAST.ordinal()]) ? Geometry.cable_corner_max : maxX; - + renderer.setRenderBounds(minX, minY, minZ, Geometry.cable_width_min, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(Geometry.cable_width_max, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -278,13 +273,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_width_max; maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxZ = Geometry.cable_high_height; - + minY += (placed[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_low_height : 0; - maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0; - + maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0; + renderer.setRenderBounds(minX, Geometry.cable_width_max, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(minX, minY, minZ, maxX, Geometry.cable_width_min, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -295,7 +290,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_width_max; maxY = Geometry.cable_width_max; maxZ = Geometry.cable_high_height; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); @@ -310,13 +305,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_low_height; maxY = Geometry.cable_width_max; maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; - + minZ += (placed[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_low_height : 0; - maxZ -= (placed[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_low_height : 0; - + maxZ -= (placed[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_low_height : 0; + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, Geometry.cable_width_min); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(minX, minY, Geometry.cable_width_max, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -329,13 +324,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_low_height; maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxZ = Geometry.cable_width_max; - + minY += (placed[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_low_height : 0; - maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0; - + maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0; + renderer.setRenderBounds(minX, Geometry.cable_width_max, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(minX, minY, minZ, maxX, Geometry.cable_width_min, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -346,7 +341,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_low_height; maxY = Geometry.cable_width_max; maxZ = Geometry.cable_width_max; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); @@ -361,13 +356,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_high_height; maxY = Geometry.cable_width_max; maxZ = (renderDir[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; - + minZ += (placed[ForgeDirection.NORTH.ordinal()]) ? Geometry.cable_low_height : 0; - maxZ -= (placed[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_low_height : 0; - + maxZ -= (placed[ForgeDirection.SOUTH.ordinal()]) ? Geometry.cable_low_height : 0; + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, Geometry.cable_width_min); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(minX, minY, Geometry.cable_width_max, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -380,13 +375,13 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_high_height; maxY = (renderDir[ForgeDirection.UP.ordinal()]) ? Geometry.cable_extend_max : Geometry.cable_width_max; maxZ = Geometry.cable_width_max; - + minY += (placed[ForgeDirection.DOWN.ordinal()]) ? Geometry.cable_low_height : 0; - maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0; - + maxY -= (placed[ForgeDirection.UP.ordinal()]) ? Geometry.cable_low_height : 0; + renderer.setRenderBounds(minX, Geometry.cable_width_max, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); - + renderer.setRenderBounds(minX, minY, minZ, maxX, Geometry.cable_width_min, maxZ); renderer.renderStandardBlock(block, x, y, z); } @@ -397,7 +392,7 @@ public class SignalBusRender implements ISimpleBlockRenderingHandler maxX = Geometry.cable_high_height; maxY = Geometry.cable_width_max; maxZ = Geometry.cable_width_max; - + renderer.setRenderBounds(minX, minY, minZ, maxX, maxY, maxZ); renderer.renderStandardBlock(block, x, y, z); diff --git a/src/tconstruct/client/block/SlimeChannelRender.java b/src/tconstruct/client/block/SlimeChannelRender.java index 4e670586..b3210f2a 100644 --- a/src/tconstruct/client/block/SlimeChannelRender.java +++ b/src/tconstruct/client/block/SlimeChannelRender.java @@ -17,7 +17,7 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler public static int model = RenderingRegistry.getNextAvailableRenderId(); @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) + public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) { if (modelID == model) { @@ -26,7 +26,7 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) + public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) { if (modelID == model) { @@ -35,20 +35,20 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler } return true; } - + static final float LIGHT_Y_NEG = 0.5F; static final float LIGHT_Y_POS = 1.0F; static final float LIGHT_XZ_NEG = 0.8F; static final float LIGHT_XZ_POS = 0.6F; - public boolean renderRotatedBlock(Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer) + public boolean renderRotatedBlock (Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer) { if (true) { Tessellator tessellator = Tessellator.instance; int bMeta = world.getBlockMetadata(x, y, z); Icon iconStill = block.getIcon(1, bMeta); - float flowDir = (float) (bMeta / 8f * 2*Math.PI); //Tau, radians + float flowDir = (float) (bMeta / 8f * 2 * Math.PI); //Tau, radians double u1, u2, u3, u4, v1, v2, v3, v4; @@ -106,13 +106,13 @@ public class SlimeChannelRender implements ISimpleBlockRenderingHandler } @Override - public boolean shouldRender3DInInventory() + public boolean shouldRender3DInInventory () { return true; } @Override - public int getRenderId() + public int getRenderId () { return model; } diff --git a/src/tconstruct/client/block/SlimePadRender.java b/src/tconstruct/client/block/SlimePadRender.java index d24d2a06..8fe61981 100644 --- a/src/tconstruct/client/block/SlimePadRender.java +++ b/src/tconstruct/client/block/SlimePadRender.java @@ -14,7 +14,7 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler public static int model = RenderingRegistry.getNextAvailableRenderId(); @Override - public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) + public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) { if (modelID == model) { @@ -23,7 +23,7 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler } @Override - public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) + public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) { if (modelID == model) { @@ -39,31 +39,39 @@ public class SlimePadRender implements ISimpleBlockRenderingHandler return true; } - float[] size(int meta) + float[] size (int meta) { //xMin, zMin, xMax, zMax switch (meta) { - case 0: return new float[] {0.375f, 0.6875f, 0.625f, 0.9375f}; - case 1: return new float[] {0.0625f, 0.6875f, 0.3125f, 0.9375f}; - case 2: return new float[] {0.0625f, 0.375f, 0.3125f, 0.625f}; - case 3: return new float[] {0.0625f, 0.0625f, 0.3125f, 0.3125f}; - case 4: return new float[] {0.375f, 0.0625f, 0.625f, 0.3125f}; - case 5: return new float[] {0.6875f, 0.0625f, 0.9375f, 0.3125f}; - case 6: return new float[] {0.6875f, 0.375f, 0.9375f, 0.625f}; - case 7: return new float[] {0.6875f, 0.6875f, 0.9375f, 0.9375f}; + case 0: + return new float[] { 0.375f, 0.6875f, 0.625f, 0.9375f }; + case 1: + return new float[] { 0.0625f, 0.6875f, 0.3125f, 0.9375f }; + case 2: + return new float[] { 0.0625f, 0.375f, 0.3125f, 0.625f }; + case 3: + return new float[] { 0.0625f, 0.0625f, 0.3125f, 0.3125f }; + case 4: + return new float[] { 0.375f, 0.0625f, 0.625f, 0.3125f }; + case 5: + return new float[] { 0.6875f, 0.0625f, 0.9375f, 0.3125f }; + case 6: + return new float[] { 0.6875f, 0.375f, 0.9375f, 0.625f }; + case 7: + return new float[] { 0.6875f, 0.6875f, 0.9375f, 0.9375f }; } - return new float[] { 0.375f, 0.375f, 0.625f, 0.625f}; + return new float[] { 0.375f, 0.375f, 0.625f, 0.625f }; } @Override - public boolean shouldRender3DInInventory() + public boolean shouldRender3DInInventory () { return true; } @Override - public int getRenderId() + public int getRenderId () { return model; } diff --git a/src/tconstruct/client/entity/item/ExplosiveRender.java b/src/tconstruct/client/entity/item/ExplosiveRender.java index 3d41277c..bb5420ef 100644 --- a/src/tconstruct/client/entity/item/ExplosiveRender.java +++ b/src/tconstruct/client/entity/item/ExplosiveRender.java @@ -25,15 +25,15 @@ public class ExplosiveRender extends Render this.shadowSize = 0.5F; } - public void renderPrimedTNT(ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9) + public void renderPrimedTNT (ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9) { GL11.glPushMatrix(); - GL11.glTranslatef((float)par2, (float)par4, (float)par6); + GL11.glTranslatef((float) par2, (float) par4, (float) par6); float f2; - if ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F) + if ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F) { - f2 = 1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F; + f2 = 1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F; if (f2 < 0.0F) { @@ -51,7 +51,7 @@ public class ExplosiveRender extends Render GL11.glScalef(f3, f3, f3); } - f2 = (1.0F - ((float)par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F; + f2 = (1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(par1EntityTNTPrimed); this.blockRenderer.renderBlockAsItem(TContent.slimeExplosive, 0, par1EntityTNTPrimed.getBrightness(par9)); @@ -72,7 +72,7 @@ public class ExplosiveRender extends Render GL11.glPopMatrix(); } - protected ResourceLocation func_110808_a(ExplosivePrimed par1EntityTNTPrimed) + protected ResourceLocation func_110808_a (ExplosivePrimed par1EntityTNTPrimed) { return TextureMap.locationBlocksTexture; } @@ -80,9 +80,9 @@ public class ExplosiveRender extends Render /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ - protected ResourceLocation getEntityTexture(Entity par1Entity) + protected ResourceLocation getEntityTexture (Entity par1Entity) { - return this.func_110808_a((ExplosivePrimed)par1Entity); + return this.func_110808_a((ExplosivePrimed) par1Entity); } /** @@ -91,8 +91,8 @@ public class ExplosiveRender extends Render * (Render cloaks = new HashMap(); - private ArrayList capePlayers = new ArrayList(); + private static final Graphics TEST_GRAPHICS = new BufferedImage(128, 128, BufferedImage.TYPE_INT_RGB).getGraphics(); + private HashMap cloaks = new HashMap(); + private ArrayList capePlayers = new ArrayList(); - public static EventCloakRender instance; + public static EventCloakRender instance; - public EventCloakRender() { - buildCloakURLDatabase(); - instance = this; - } + public EventCloakRender() + { + buildCloakURLDatabase(); + instance = this; + } - @ForgeSubscribe - public void onPreRenderSpecials(RenderPlayerEvent.Specials.Pre event) { - if (Loader.isModLoaded("shadersmod")) { - return; - } - if (event.entityPlayer instanceof AbstractClientPlayer) { - AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer; + @ForgeSubscribe + public void onPreRenderSpecials (RenderPlayerEvent.Specials.Pre event) + { + if (Loader.isModLoaded("shadersmod")) + { + return; + } + if (event.entityPlayer instanceof AbstractClientPlayer) + { + AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer; - if (!capePlayers.contains(abstractClientPlayer)) { - String cloakURL = cloaks.get(event.entityPlayer.username); + if (!capePlayers.contains(abstractClientPlayer)) + { + String cloakURL = cloaks.get(event.entityPlayer.username); - if (cloakURL == null) { - return; - } + if (cloakURL == null) + { + return; + } - capePlayers.add(abstractClientPlayer); + capePlayers.add(abstractClientPlayer); - abstractClientPlayer.getTextureCape().textureUploaded = false; - new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start(); - event.renderCape = true; - } - } - } + abstractClientPlayer.getTextureCape().textureUploaded = false; + new Thread(new CloakThread(abstractClientPlayer, cloakURL)).start(); + event.renderCape = true; + } + } + } - public void buildCloakURLDatabase() { - URL url; - try { - url = new URL(serverLocation); - URLConnection con = url.openConnection(); - con.setConnectTimeout(timeout); - con.setReadTimeout(timeout); - InputStream io = con.getInputStream(); - BufferedReader br = new BufferedReader(new InputStreamReader(io)); + public void buildCloakURLDatabase () + { + URL url; + try + { + url = new URL(serverLocation); + URLConnection con = url.openConnection(); + con.setConnectTimeout(timeout); + con.setReadTimeout(timeout); + InputStream io = con.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(io)); - String str; - int linetracker = 1; - while ((str = br.readLine()) != null) { - if (!str.startsWith("--")) { - if (str.contains(":")) { - String nick = str.substring(0, str.indexOf(":")); - String link = str.substring(str.indexOf(":") + 1); - new Thread(new CloakPreload(link)).start(); - cloaks.put(nick, link); - } else { - System.err.println("[TinkersConstruct] [skins.txt] Syntax error on line " + linetracker + ": " + str); - } - } - linetracker++; - } + String str; + int linetracker = 1; + while ((str = br.readLine()) != null) + { + if (!str.startsWith("--")) + { + if (str.contains(":")) + { + String nick = str.substring(0, str.indexOf(":")); + String link = str.substring(str.indexOf(":") + 1); + new Thread(new CloakPreload(link)).start(); + cloaks.put(nick, link); + } + else + { + System.err.println("[TinkersConstruct] [skins.txt] Syntax error on line " + linetracker + ": " + str); + } + } + linetracker++; + } - br.close(); - } catch (MalformedURLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } + br.close(); + } + catch (MalformedURLException e) + { + e.printStackTrace(); + } + catch (IOException e) + { + e.printStackTrace(); + } + } - private class CloakThread implements Runnable { + private class CloakThread implements Runnable + { - AbstractClientPlayer abstractClientPlayer; - String cloakURL; + AbstractClientPlayer abstractClientPlayer; + String cloakURL; - public CloakThread(AbstractClientPlayer player, String cloak) { - abstractClientPlayer = player; - cloakURL = cloak; - } + public CloakThread(AbstractClientPlayer player, String cloak) + { + abstractClientPlayer = player; + cloakURL = cloak; + } - @Override - public void run() { - try { - Image cape = new ImageIcon(new URL(cloakURL)).getImage(); - BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB); - bo.getGraphics().drawImage(cape, 0, 0, null); - abstractClientPlayer.getTextureCape().bufferedImage = bo; - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } - } + @Override + public void run () + { + try + { + Image cape = new ImageIcon(new URL(cloakURL)).getImage(); + BufferedImage bo = new BufferedImage(cape.getWidth(null), cape.getHeight(null), BufferedImage.TYPE_INT_ARGB); + bo.getGraphics().drawImage(cape, 0, 0, null); + abstractClientPlayer.getTextureCape().bufferedImage = bo; + } + catch (MalformedURLException e) + { + e.printStackTrace(); + } + } + } - private class CloakPreload implements Runnable { - String cloakURL; + private class CloakPreload implements Runnable + { + String cloakURL; - public CloakPreload(String link) { - cloakURL = link; - } + public CloakPreload(String link) + { + cloakURL = link; + } - @Override - public void run() { - try { - TEST_GRAPHICS.drawImage(new ImageIcon(new URL(cloakURL)).getImage(), 0, 0, null); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } - } + @Override + public void run () + { + try + { + TEST_GRAPHICS.drawImage(new ImageIcon(new URL(cloakURL)).getImage(), 0, 0, null); + } + catch (MalformedURLException e) + { + e.printStackTrace(); + } + } + } - public void refreshCapes() { - cloaks.clear(); - capePlayers.clear(); - buildCloakURLDatabase(); - } + public void refreshCapes () + { + cloaks.clear(); + capePlayers.clear(); + buildCloakURLDatabase(); + } } diff --git a/src/tconstruct/client/gui/AdvDrawbridgeButton.java b/src/tconstruct/client/gui/AdvDrawbridgeButton.java index 0665d90d..80707d5a 100644 --- a/src/tconstruct/client/gui/AdvDrawbridgeButton.java +++ b/src/tconstruct/client/gui/AdvDrawbridgeButton.java @@ -7,137 +7,154 @@ import org.lwjgl.opengl.GL11; import net.minecraft.client.gui.GuiButton; -public class AdvDrawbridgeButton extends GuiButton { - protected static final ResourceLocation buttonTextures = new ResourceLocation("tinker:textures/gui/slotButton.png"); +public class AdvDrawbridgeButton extends GuiButton +{ + protected static final ResourceLocation buttonTextures = new ResourceLocation("tinker:textures/gui/slotButton.png"); - /** Button width in pixels */ - protected int width; + /** Button width in pixels */ + protected int width; - /** Button height in pixels */ - protected int height; + /** Button height in pixels */ + protected int height; - /** The x position of this control. */ - public int xPosition; + /** The x position of this control. */ + public int xPosition; - /** The y position of this control. */ - public int yPosition; - - /** The x position of this control when the GUI is expanded. */ - public int xPositionExp; - - /** The x position of this control when the GUI is expanded. */ - public int yPositionExp; - - /** Is the GUI expanded. */ - public boolean isGuiExpanded = false; - - /** The string displayed on this control. */ - public String displayString; + /** The y position of this control. */ + public int yPosition; - /** ID for this control. */ - public int id; + /** The x position of this control when the GUI is expanded. */ + public int xPositionExp; - /** True if this control is enabled, false to disable. */ - public boolean enabled; + /** The x position of this control when the GUI is expanded. */ + public int yPositionExp; - /** Hides the button completely if false. */ - public boolean drawButton; - protected boolean field_82253_i; + /** Is the GUI expanded. */ + public boolean isGuiExpanded = false; - public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, String par6Str) { - this(par1, par2, par3, par4, par5, 200, 20, par6Str); - } + /** The string displayed on this control. */ + public String displayString; - public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, int par6, int par7, String par8Str) { - super(par1, par2, par3, par6, par7, par8Str); - this.width = 200; - this.height = 20; - this.enabled = true; - this.drawButton = true; - this.id = par1; - this.xPosition = par2; - this.yPosition = par3; - this.xPositionExp = par4; - this.yPositionExp = par5; - this.width = par6; - this.height = par7; - this.displayString = par8Str; - } + /** ID for this control. */ + public int id; - /** - * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over - * this button and 2 if it IS hovering over this button. - */ - protected int getHoverState(boolean par1) { - byte b0 = 1; + /** True if this control is enabled, false to disable. */ + public boolean enabled; - if (!this.enabled) { - b0 = 0; - } else if (par1) { - b0 = 2; - } + /** Hides the button completely if false. */ + public boolean drawButton; + protected boolean field_82253_i; - return b0; - } + public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, String par6Str) + { + this(par1, par2, par3, par4, par5, 200, 20, par6Str); + } - /** - * Draws this button to the screen. - */ - public void drawButton(Minecraft par1Minecraft, int par2, int par3) { - if (this.drawButton) { - FontRenderer fontrenderer = par1Minecraft.fontRenderer; - par1Minecraft.getTextureManager().bindTexture(buttonTextures); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - int xPosition = isGuiExpanded ? this.xPositionExp : this.xPosition; - int yPosition = isGuiExpanded ? this.yPositionExp : this.yPosition; - - this.field_82253_i = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + this.width && par3 < yPosition + this.height; - int k = this.getHoverState(this.field_82253_i); - this.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 26, this.width / 2, this.height); - this.drawTexturedModalRect(xPosition + this.width / 2, yPosition, 200 - this.width / 2, 46 + k * 26, this.width / 2, this.height); - this.mouseDragged(par1Minecraft, par2, par3); - int l = 14737632; + public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, int par6, int par7, String par8Str) + { + super(par1, par2, par3, par6, par7, par8Str); + this.width = 200; + this.height = 20; + this.enabled = true; + this.drawButton = true; + this.id = par1; + this.xPosition = par2; + this.yPosition = par3; + this.xPositionExp = par4; + this.yPositionExp = par5; + this.width = par6; + this.height = par7; + this.displayString = par8Str; + } - if (!this.enabled) { - l = -6250336; - } else if (this.field_82253_i) { - l = 16777120; - } + /** + * Returns 0 if the button is disabled, 1 if the mouse is NOT hovering over + * this button and 2 if it IS hovering over this button. + */ + protected int getHoverState (boolean par1) + { + byte b0 = 1; - this.drawCenteredString(fontrenderer, this.displayString, xPosition + this.width / 2, yPosition + (this.height - 8) / 2, l); - } - } + if (!this.enabled) + { + b0 = 0; + } + else if (par1) + { + b0 = 2; + } - /** - * Fired when the mouse button is dragged. Equivalent of - * MouseListener.mouseDragged(MouseEvent e). - */ - protected void mouseDragged(Minecraft par1Minecraft, int par2, int par3) { - } + return b0; + } - /** - * Fired when the mouse button is released. Equivalent of - * MouseListener.mouseReleased(MouseEvent e). - */ - public void mouseReleased(int par1, int par2) { - } + /** + * Draws this button to the screen. + */ + public void drawButton (Minecraft par1Minecraft, int par2, int par3) + { + if (this.drawButton) + { + FontRenderer fontrenderer = par1Minecraft.fontRenderer; + par1Minecraft.getTextureManager().bindTexture(buttonTextures); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - /** - * Returns true if the mouse has been pressed on this control. Equivalent of - * MouseListener.mousePressed(MouseEvent e). - */ - public boolean mousePressed(Minecraft par1Minecraft, int par2, int par3) { - int xPosition = isGuiExpanded ? this.xPositionExp : this.xPosition; - int yPosition = isGuiExpanded ? this.yPositionExp : this.yPosition; - - return this.enabled && this.drawButton && par2 >= xPosition && par3 >= yPosition && par2 < xPosition + this.width && par3 < yPosition + this.height; - } + int xPosition = isGuiExpanded ? this.xPositionExp : this.xPosition; + int yPosition = isGuiExpanded ? this.yPositionExp : this.yPosition; - public boolean func_82252_a() { - return this.field_82253_i; - } + this.field_82253_i = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + this.width && par3 < yPosition + this.height; + int k = this.getHoverState(this.field_82253_i); + this.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 26, this.width / 2, this.height); + this.drawTexturedModalRect(xPosition + this.width / 2, yPosition, 200 - this.width / 2, 46 + k * 26, this.width / 2, this.height); + this.mouseDragged(par1Minecraft, par2, par3); + int l = 14737632; - public void func_82251_b(int par1, int par2) { - } + if (!this.enabled) + { + l = -6250336; + } + else if (this.field_82253_i) + { + l = 16777120; + } + + this.drawCenteredString(fontrenderer, this.displayString, xPosition + this.width / 2, yPosition + (this.height - 8) / 2, l); + } + } + + /** + * Fired when the mouse button is dragged. Equivalent of + * MouseListener.mouseDragged(MouseEvent e). + */ + protected void mouseDragged (Minecraft par1Minecraft, int par2, int par3) + { + } + + /** + * Fired when the mouse button is released. Equivalent of + * MouseListener.mouseReleased(MouseEvent e). + */ + public void mouseReleased (int par1, int par2) + { + } + + /** + * Returns true if the mouse has been pressed on this control. Equivalent of + * MouseListener.mousePressed(MouseEvent e). + */ + public boolean mousePressed (Minecraft par1Minecraft, int par2, int par3) + { + int xPosition = isGuiExpanded ? this.xPositionExp : this.xPosition; + int yPosition = isGuiExpanded ? this.yPositionExp : this.yPosition; + + return this.enabled && this.drawButton && par2 >= xPosition && par3 >= yPosition && par2 < xPosition + this.width && par3 < yPosition + this.height; + } + + public boolean func_82252_a () + { + return this.field_82253_i; + } + + public void func_82251_b (int par1, int par2) + { + } } \ No newline at end of file diff --git a/src/tconstruct/client/gui/AdvDrawbridgeGui.java b/src/tconstruct/client/gui/AdvDrawbridgeGui.java index 08bbdcc5..9474dc6a 100644 --- a/src/tconstruct/client/gui/AdvDrawbridgeGui.java +++ b/src/tconstruct/client/gui/AdvDrawbridgeGui.java @@ -16,10 +16,10 @@ import tconstruct.inventory.AdvancedDrawbridgeContainer; public class AdvDrawbridgeGui extends GuiContainer { public AdvancedDrawbridgeLogic logic; - + public boolean isGuiExpanded = false; public boolean containerNeglectMouse = false; - + public AdvDrawbridgeGui(EntityPlayer player, AdvancedDrawbridgeLogic frypan, World world, int x, int y, int z) { super(frypan.getGuiContainer(player.inventory, world, x, y, z)); @@ -43,18 +43,24 @@ public class AdvDrawbridgeGui extends GuiContainer int cornerX = (width - xSize) / 2; int cornerY = (height - ySize) / 2; drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize); - if(!isGuiExpanded){ - drawTexturedModalRect(cornerX + 34, cornerY + 35, 238, 0, 18, 18); - }else{ - for(int index = 0; index < 16; index++){ - drawTexturedModalRect(index < 8 ? cornerX + 9 + 20 * index : cornerX + 9 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1), 238, 0, 18, 18); - if(index != 15){ - drawTexturedModalRect(index < 8 ? cornerX + 26 + 20 * index : cornerX + 26 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1) + 6, 253, 18, 3, 5); - } - } -// drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40); -// drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40); -// drawTexturedModalRect(cornerX + 173, cornerY + 29, 10, 167, 10, 40); + if (!isGuiExpanded) + { + drawTexturedModalRect(cornerX + 34, cornerY + 35, 238, 0, 18, 18); + } + else + { + for (int index = 0; index < 16; index++) + { + drawTexturedModalRect(index < 8 ? cornerX + 9 + 20 * index : cornerX + 9 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1), 238, 0, 18, 18); + if (index != 15) + { + drawTexturedModalRect(index < 8 ? cornerX + 26 + 20 * index : cornerX + 26 + 20 * (index - 8), cornerY + 34 + (int) Math.floor(index / 8) * 18 + (index < 8 ? 0 : 1) + 6, 253, 18, + 3, 5); + } + } + // drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40); + // drawTexturedModalRect(cornerX - 7, cornerY + 29, 0, 167, 10, 40); + // drawTexturedModalRect(cornerX + 173, cornerY + 29, 10, 167, 10, 40); } } @@ -86,32 +92,38 @@ public class AdvDrawbridgeGui extends GuiContainer if (logic.getPlacementDirection() == 4) button.enabled = false; this.buttonList.add(button); - + this.buttonList.add(new AdvDrawbridgeButton(5, this.width / 2 - 13, this.height / 2 - 52, this.width / 2 + 58, this.height / 2 - 79, 26, 26, "Inv")); } - public void setExpanded(boolean flag){ - this.isGuiExpanded = flag; - this.containerNeglectMouse = true; - Iterator i1 = this.buttonList.iterator(); - while(i1.hasNext()){ - GuiButton b = i1.next(); - if(b instanceof AdvDrawbridgeButton){ - ((AdvDrawbridgeButton)b).isGuiExpanded = flag; - } else { - b.drawButton = !flag; - } - } - ((AdvancedDrawbridgeContainer)this.inventorySlots).updateContainerSlots(); + public void setExpanded (boolean flag) + { + this.isGuiExpanded = flag; + this.containerNeglectMouse = true; + Iterator i1 = this.buttonList.iterator(); + while (i1.hasNext()) + { + GuiButton b = i1.next(); + if (b instanceof AdvDrawbridgeButton) + { + ((AdvDrawbridgeButton) b).isGuiExpanded = flag; + } + else + { + b.drawButton = !flag; + } + } + ((AdvancedDrawbridgeContainer) this.inventorySlots).updateContainerSlots(); } - + protected void actionPerformed (GuiButton button) { - if(button.id == 5){ - setExpanded(!isGuiExpanded); - return; - } - + if (button.id == 5) + { + setExpanded(!isGuiExpanded); + return; + } + for (Object o : buttonList) { GuiButton b = (GuiButton) o; @@ -148,10 +160,11 @@ public class AdvDrawbridgeGui extends GuiContainer PacketDispatcher.sendPacketToServer(packet); } - + @Override - public void updateScreen(){ - super.updateScreen(); - this.containerNeglectMouse = false; + public void updateScreen () + { + super.updateScreen(); + this.containerNeglectMouse = false; } } diff --git a/src/tconstruct/client/gui/FurnaceGui.java b/src/tconstruct/client/gui/FurnaceGui.java index 15902873..94d3612f 100644 --- a/src/tconstruct/client/gui/FurnaceGui.java +++ b/src/tconstruct/client/gui/FurnaceGui.java @@ -27,7 +27,7 @@ public class FurnaceGui extends GuiContainer /** * Draw the foreground layer for the GuiContainer (everything in front of the items) */ - protected void drawGuiContainerForegroundLayer(int par1, int par2) + protected void drawGuiContainerForegroundLayer (int par1, int par2) { String s = this.logic.isInvNameLocalized() ? this.logic.getInvName() : I18n.getString(this.logic.getInvName()); this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752); @@ -37,7 +37,7 @@ public class FurnaceGui extends GuiContainer /** * Draw the background layer for the GuiContainer (everything behind the items) */ - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) + protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(furnaceGuiTextures); diff --git a/src/tconstruct/common/SpoolRepairRecipe.java b/src/tconstruct/common/SpoolRepairRecipe.java index d9bd1e52..b2f799a1 100644 --- a/src/tconstruct/common/SpoolRepairRecipe.java +++ b/src/tconstruct/common/SpoolRepairRecipe.java @@ -9,13 +9,14 @@ public class SpoolRepairRecipe implements IRecipe { ItemStack spool; ItemStack wire; - + public SpoolRepairRecipe(ItemStack spool, ItemStack wire) { this.spool = spool.copy(); this.spool.setItemDamage(256); this.wire = wire.copy(); } + @Override public boolean matches (InventoryCrafting inventorycrafting, World world) { @@ -35,7 +36,7 @@ public class SpoolRepairRecipe implements IRecipe return false; } foundSpool = true; - } + } else if (tmpStack.itemID == wire.itemID && tmpStack.getItemDamage() == wire.getItemDamage()) { ++countWire; @@ -50,7 +51,7 @@ public class SpoolRepairRecipe implements IRecipe return true; } } - + return false; } @@ -71,7 +72,7 @@ public class SpoolRepairRecipe implements IRecipe { newSpool = tmpStack.copy(); foundSpool = true; - } + } else if (tmpStack.itemID == wire.itemID && tmpStack.getItemDamage() == wire.getItemDamage()) { ++countWire; @@ -82,7 +83,7 @@ public class SpoolRepairRecipe implements IRecipe { newSpool.setItemDamage(newSpool.getItemDamage() - countWire); } - + return newSpool; } diff --git a/src/tconstruct/common/TContent.java b/src/tconstruct/common/TContent.java index dadf2083..6cd3927d 100644 --- a/src/tconstruct/common/TContent.java +++ b/src/tconstruct/common/TContent.java @@ -342,7 +342,7 @@ public class TContent implements IFuelHandler craftingSlabWood = new CraftingSlab(PHConstruct.woodCrafterSlab, Material.wood).setUnlocalizedName("CraftingSlab"); GameRegistry.registerBlock(craftingSlabWood, CraftingSlabItemBlock.class, "CraftingSlab"); - + furnaceSlab = new FurnaceSlab(PHConstruct.furnaceSlab, Material.rock).setUnlocalizedName("FurnaceSlab"); GameRegistry.registerBlock(furnaceSlab, "FurnaceSlab"); GameRegistry.registerTileEntity(FurnaceLogic.class, "TConstruct.Furnace"); @@ -798,7 +798,7 @@ public class TContent implements IFuelHandler essenceExtractor = new EssenceExtractor(PHConstruct.essenceExtractor).setHardness(12f).setUnlocalizedName("extractor.essence"); GameRegistry.registerBlock(essenceExtractor, "extractor.essence"); GameRegistry.registerTileEntity(EssenceExtractorLogic.class, "extractor.essence"); - + terraformer = new Terraformer(PHConstruct.terraformer).setHardness(50f).setUnlocalizedName("terraformer"); GameRegistry.registerBlock(terraformer, TerraformerItem.class, "terraformer"); GameRegistry.registerTileEntity(TerraformerLogic.class, "TerraFreezer"); @@ -1189,7 +1189,7 @@ public class TContent implements IFuelHandler GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolStationWood, 1, 10), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "plankWood")); } GameRegistry.addRecipe(new ItemStack(furnaceSlab, 1, 0), "###", "# #", "###", '#', new ItemStack(Block.stoneSingleSlab, 1, 3)); - + // Blank Pattern Recipe GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', "stickWood")); // Manual Book Recipes @@ -1513,7 +1513,6 @@ public class TContent implements IFuelHandler modF = new ModFlux(); tb.registerToolMod(modF); - ItemStack redstoneItem = new ItemStack(Item.redstone); ItemStack redstoneBlock = new ItemStack(Block.blockRedstone); tb.registerToolMod(new ModRedstone(new ItemStack[] { redstoneItem }, 2, 1)); @@ -2204,18 +2203,18 @@ public class TContent implements IFuelHandler { ItemStack ironpick = ToolBuilder.instance.buildTool(new ItemStack(TContent.pickaxeHead, 1, 6), new ItemStack(TContent.toolRod, 1, 2), new ItemStack(TContent.binding, 1, 6), ""); /*TE3 Flux*/ - ItemStack batHardened = GameRegistry.findItemStack("ThermalExpansion", "batteryHardened", 1); + ItemStack batHardened = GameRegistry.findItemStack("ThermalExpansion", "batteryHardened", 1); if (batHardened != null) { modF.batteries.add(batHardened); } - ItemStack basicCell = GameRegistry.findItemStack("ThermalExpansion", "cellBasic", 1); + ItemStack basicCell = GameRegistry.findItemStack("ThermalExpansion", "cellBasic", 1); if (basicCell != null) { modF.batteries.add(basicCell); } /* IC2 */ - + //ItemStack reBattery = ic2.api.item.Items.getItem("reBattery"); Object reBattery = getStaticItem("reBattery", "ic2.core.Ic2Items"); if (reBattery != null) @@ -2340,7 +2339,7 @@ public class TContent implements IFuelHandler { basinCasting.addCastingRecipe(ores.get(0), new FluidStack(moltenElectrumFluid, TConstruct.blockLiquidValue), null, 100); } - + /* Extra Utilities */ ores = OreDictionary.getOres("compressedGravel1x"); if (ores.size() > 0) @@ -2350,7 +2349,7 @@ public class TContent implements IFuelHandler ores = OreDictionary.getOres("compressedGravel2x"); //Higher won't save properly if (ores.size() > 0) { - basinCasting.addCastingRecipe(new ItemStack(speedBlock, 81), new FluidStack(moltenElectrumFluid, TConstruct.blockLiquidValue*9), ores.get(0), 100); + basinCasting.addCastingRecipe(new ItemStack(speedBlock, 81), new FluidStack(moltenElectrumFluid, TConstruct.blockLiquidValue * 9), ores.get(0), 100); } } @@ -2411,13 +2410,13 @@ public class TContent implements IFuelHandler registerPatternMaterial("block" + ft.toString(), 18, ft.toString()); } } - + //Compressed materials for (int i = 1; i <= 8; i++) { - Smeltery.addDictionaryMelting("compressedCobblestone"+i+"x", FluidType.Stone, 0, TConstruct.ingotLiquidValue / 18 * (9^i)); + Smeltery.addDictionaryMelting("compressedCobblestone" + i + "x", FluidType.Stone, 0, TConstruct.ingotLiquidValue / 18 * (9 ^ i)); } - Smeltery.addDictionaryMelting("compressedSand1x", FluidType.Glass, 175, FluidContainerRegistry.BUCKET_VOLUME*9); + Smeltery.addDictionaryMelting("compressedSand1x", FluidType.Glass, 175, FluidContainerRegistry.BUCKET_VOLUME * 9); registerPatternMaterial("plankWood", 2, "Wood"); registerPatternMaterial("stickWood", 1, "Wood"); diff --git a/src/tconstruct/common/TProxyCommon.java b/src/tconstruct/common/TProxyCommon.java index d7ca850f..7143f098 100644 --- a/src/tconstruct/common/TProxyCommon.java +++ b/src/tconstruct/common/TProxyCommon.java @@ -26,7 +26,7 @@ public class TProxyCommon implements IGuiHandler public static int stencilTableID = 3; public static int frypanGuiID = 4; public static int toolForgeID = 5; - + public static int smelteryGuiID = 7; public static int furnaceID = 8; public static int drawbridgeID = 9; @@ -37,7 +37,6 @@ public class TProxyCommon implements IGuiHandler public static int armorGuiID = 101; public static int knapsackGuiID = 102; - public static int manualGuiID = -1; @Override @@ -89,7 +88,7 @@ public class TProxyCommon implements IGuiHandler public void registerTickHandler () { //TickRegistry.registerTickHandler(new TimeTicker(), Side.SERVER); - TickRegistry.registerScheduledTickHandler(new MultiblockServerTickHandler(), Side.SERVER); + TickRegistry.registerScheduledTickHandler(new MultiblockServerTickHandler(), Side.SERVER); } /* Registers any rendering code. Does nothing server-side */ @@ -122,8 +121,9 @@ public class TProxyCommon implements IGuiHandler public static final String[] patterns = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring", "fletching", "arrowhead" }; - - public void postInit(){ - + + public void postInit () + { + } } diff --git a/src/tconstruct/entity/BlueSlime.java b/src/tconstruct/entity/BlueSlime.java index 79ec95ea..d07ed596 100644 --- a/src/tconstruct/entity/BlueSlime.java +++ b/src/tconstruct/entity/BlueSlime.java @@ -234,7 +234,7 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData return 4; if (i == 8) return 100; - return (float)Math.min(i * i + 8, 49); + return (float) Math.min(i * i + 8, 49); } /** diff --git a/src/tconstruct/entity/item/EntityLandmineFirework.java b/src/tconstruct/entity/item/EntityLandmineFirework.java index f5014ab1..8fd0be4b 100644 --- a/src/tconstruct/entity/item/EntityLandmineFirework.java +++ b/src/tconstruct/entity/item/EntityLandmineFirework.java @@ -9,207 +9,238 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class EntityLandmineFirework extends Entity { - /** The age of the firework in ticks. */ - private int fireworkAge; +public class EntityLandmineFirework extends Entity +{ + /** The age of the firework in ticks. */ + private int fireworkAge; - /** - * The lifetime of the firework in ticks. When the age reaches the lifetime the firework explodes. - */ - private int lifetime; + /** + * The lifetime of the firework in ticks. When the age reaches the lifetime the firework explodes. + */ + private int lifetime; - private Entity rider; - - private int moveDirection = 0; - - public EntityLandmineFirework(World par1World) { - super(par1World); - this.setSize(0.25F, 0.25F); - } + private Entity rider; - protected void entityInit() { - this.dataWatcher.addObjectByDataType(8, 5); - } - - public EntityLandmineFirework setRider(Entity entity){ - rider = entity; - return this; - } + private int moveDirection = 0; - @SideOnly(Side.CLIENT) - /** - * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge - * length * 64 * renderDistanceWeight Args: distance - */ - public boolean isInRangeToRenderDist(double par1) { - return par1 < 4096.0D; - } + public EntityLandmineFirework(World par1World) + { + super(par1World); + this.setSize(0.25F, 0.25F); + } - public EntityLandmineFirework(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack, int moveDirection) { - super(par1World); - this.fireworkAge = 0; - this.setSize(0.25F, 0.25F); - this.setPosition(par2, par4, par6); - this.yOffset = 0.0F; - int i = 1; + protected void entityInit () + { + this.dataWatcher.addObjectByDataType(8, 5); + } - if (par8ItemStack != null && par8ItemStack.hasTagCompound()) { - this.dataWatcher.updateObject(8, par8ItemStack); - NBTTagCompound nbttagcompound = par8ItemStack.getTagCompound(); - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Fireworks"); + public EntityLandmineFirework setRider (Entity entity) + { + rider = entity; + return this; + } - if (nbttagcompound1 != null) { - i += nbttagcompound1.getByte("Flight"); - } - } + @SideOnly(Side.CLIENT) + /** + * Checks if the entity is in range to render by using the past in distance and comparing it to its average edge + * length * 64 * renderDistanceWeight Args: distance + */ + public boolean isInRangeToRenderDist (double par1) + { + return par1 < 4096.0D; + } - this.motionX = this.rand.nextGaussian() * 0.001D; - this.motionZ = this.rand.nextGaussian() * 0.001D; - this.motionY = 0.05D; - this.lifetime = 10 * i + this.rand.nextInt(6) + this.rand.nextInt(7); - this.moveDirection = moveDirection; - } + public EntityLandmineFirework(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack, int moveDirection) + { + super(par1World); + this.fireworkAge = 0; + this.setSize(0.25F, 0.25F); + this.setPosition(par2, par4, par6); + this.yOffset = 0.0F; + int i = 1; - @SideOnly(Side.CLIENT) - /** - * Sets the velocity to the args. Args: x, y, z - */ - public void setVelocity(double par1, double par3, double par5) { - this.motionX = par1; - this.motionY = par3; - this.motionZ = par5; + if (par8ItemStack != null && par8ItemStack.hasTagCompound()) + { + this.dataWatcher.updateObject(8, par8ItemStack); + NBTTagCompound nbttagcompound = par8ItemStack.getTagCompound(); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Fireworks"); - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { - float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); - this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) * 180.0D / Math.PI); - } - } + if (nbttagcompound1 != null) + { + i += nbttagcompound1.getByte("Flight"); + } + } - /** - * Called to update the entity's position/logic. - */ - public void onUpdate() { - if(this.riddenByEntity == null && this.rider != null){ - this.rider.mountEntity(this); - } - - this.lastTickPosX = this.posX; - this.lastTickPosY = this.posY; - this.lastTickPosZ = this.posZ; - super.onUpdate(); - this.motionX *= 1.15D; - this.motionZ *= 1.15D; - this.motionY += 0.04D; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.motionX = this.rand.nextGaussian() * 0.001D; + this.motionZ = this.rand.nextGaussian() * 0.001D; + this.motionY = 0.05D; + this.lifetime = 10 * i + this.rand.nextInt(6) + this.rand.nextInt(7); + this.moveDirection = moveDirection; + } - for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { - ; - } + @SideOnly(Side.CLIENT) + /** + * Sets the velocity to the args. Args: x, y, z + */ + public void setVelocity (double par1, double par3, double par5) + { + this.motionX = par1; + this.motionY = par3; + this.motionZ = par5; - while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { - this.prevRotationPitch += 360.0F; - } + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) + { + float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5); + this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, (double) f) * 180.0D / Math.PI); + } + } - while (this.rotationYaw - this.prevRotationYaw < -180.0F) { - this.prevRotationYaw -= 360.0F; - } + /** + * Called to update the entity's position/logic. + */ + public void onUpdate () + { + if (this.riddenByEntity == null && this.rider != null) + { + this.rider.mountEntity(this); + } - while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { - this.prevRotationYaw += 360.0F; - } + this.lastTickPosX = this.posX; + this.lastTickPosY = this.posY; + this.lastTickPosZ = this.posZ; + super.onUpdate(); + this.motionX *= 1.15D; + this.motionZ *= 1.15D; + this.motionY += 0.04D; + this.moveEntity(this.motionX, this.motionY, this.motionZ); + float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; - this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; + for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + { + ; + } - if (this.fireworkAge == 0) { - this.worldObj.playSoundAtEntity(this, "fireworks.launch", 3.0F, 1.0F); - } + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) + { + this.prevRotationPitch += 360.0F; + } - ++this.fireworkAge; + while (this.rotationYaw - this.prevRotationYaw < -180.0F) + { + this.prevRotationYaw -= 360.0F; + } - if (this.worldObj.isRemote && this.fireworkAge % 2 < 2) { - this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D); - } + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) + { + this.prevRotationYaw += 360.0F; + } - if (!this.worldObj.isRemote && this.fireworkAge > this.lifetime) { - this.worldObj.setEntityState(this, (byte) 17); - this.rider.attackEntityFrom(new DamageSourceFireworkExplode("FireworkExplode"), 200F); - this.setDead(); - } - } + this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; + this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; - @SideOnly(Side.CLIENT) - public void handleHealthUpdate(byte par1) { - if (par1 == 17 && this.worldObj.isRemote) { - ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8); - NBTTagCompound nbttagcompound = null; + if (this.fireworkAge == 0) + { + this.worldObj.playSoundAtEntity(this, "fireworks.launch", 3.0F, 1.0F); + } - if (itemstack != null && itemstack.hasTagCompound()) { - nbttagcompound = itemstack.getTagCompound().getCompoundTag("Fireworks"); - } + ++this.fireworkAge; - this.worldObj.func_92088_a(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound); - } + if (this.worldObj.isRemote && this.fireworkAge % 2 < 2) + { + this.worldObj.spawnParticle("fireworksSpark", this.posX, this.posY - 0.3D, this.posZ, this.rand.nextGaussian() * 0.05D, -this.motionY * 0.5D, this.rand.nextGaussian() * 0.05D); + } - super.handleHealthUpdate(par1); - } + if (!this.worldObj.isRemote && this.fireworkAge > this.lifetime) + { + this.worldObj.setEntityState(this, (byte) 17); + this.rider.attackEntityFrom(new DamageSourceFireworkExplode("FireworkExplode"), 200F); + this.setDead(); + } + } - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { - par1NBTTagCompound.setInteger("Life", this.fireworkAge); - par1NBTTagCompound.setInteger("LifeTime", this.lifetime); - ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8); + @SideOnly(Side.CLIENT) + public void handleHealthUpdate (byte par1) + { + if (par1 == 17 && this.worldObj.isRemote) + { + ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8); + NBTTagCompound nbttagcompound = null; - if (itemstack != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - itemstack.writeToNBT(nbttagcompound1); - par1NBTTagCompound.setCompoundTag("FireworksItem", nbttagcompound1); - } - } + if (itemstack != null && itemstack.hasTagCompound()) + { + nbttagcompound = itemstack.getTagCompound().getCompoundTag("Fireworks"); + } - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { - this.fireworkAge = par1NBTTagCompound.getInteger("Life"); - this.lifetime = par1NBTTagCompound.getInteger("LifeTime"); - NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("FireworksItem"); + this.worldObj.func_92088_a(this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, nbttagcompound); + } - if (nbttagcompound1 != null) { - ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound1); + super.handleHealthUpdate(par1); + } - if (itemstack != null) { - this.dataWatcher.updateObject(8, itemstack); - } - } - } + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound) + { + par1NBTTagCompound.setInteger("Life", this.fireworkAge); + par1NBTTagCompound.setInteger("LifeTime", this.lifetime); + ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8); - @SideOnly(Side.CLIENT) - public float getShadowSize() { - return 0.0F; - } + if (itemstack != null) + { + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + itemstack.writeToNBT(nbttagcompound1); + par1NBTTagCompound.setCompoundTag("FireworksItem", nbttagcompound1); + } + } - /** - * Gets how bright this entity is. - */ - public float getBrightness(float par1) { - return super.getBrightness(par1); - } + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound) + { + this.fireworkAge = par1NBTTagCompound.getInteger("Life"); + this.lifetime = par1NBTTagCompound.getInteger("LifeTime"); + NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("FireworksItem"); - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float par1) { - return super.getBrightnessForRender(par1); - } + if (nbttagcompound1 != null) + { + ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound1); - /** - * If returns false, the item will not inflict any damage against entities. - */ - public boolean canAttackWithItem() { - return false; - } + if (itemstack != null) + { + this.dataWatcher.updateObject(8, itemstack); + } + } + } + + @SideOnly(Side.CLIENT) + public float getShadowSize () + { + return 0.0F; + } + + /** + * Gets how bright this entity is. + */ + public float getBrightness (float par1) + { + return super.getBrightness(par1); + } + + @SideOnly(Side.CLIENT) + public int getBrightnessForRender (float par1) + { + return super.getBrightnessForRender(par1); + } + + /** + * If returns false, the item will not inflict any damage against entities. + */ + public boolean canAttackWithItem () + { + return false; + } } diff --git a/src/tconstruct/entity/item/ExplosivePrimed.java b/src/tconstruct/entity/item/ExplosivePrimed.java index a9820951..c89b751e 100644 --- a/src/tconstruct/entity/item/ExplosivePrimed.java +++ b/src/tconstruct/entity/item/ExplosivePrimed.java @@ -30,10 +30,10 @@ public class ExplosivePrimed extends Entity { this(par1World); this.setPosition(par2, par4, par6); - float f = (float)(Math.random() * Math.PI * 2.0D); - this.motionX = (double)(-((float)Math.sin((double)f)) * 0.02F); + float f = (float) (Math.random() * Math.PI * 2.0D); + this.motionX = (double) (-((float) Math.sin((double) f)) * 0.02F); this.motionY = 0.20000000298023224D; - this.motionZ = (double)(-((float)Math.cos((double)f)) * 0.02F); + this.motionZ = (double) (-((float) Math.cos((double) f)) * 0.02F); this.fuse = 80; this.prevPosX = par2; this.prevPosY = par4; @@ -41,13 +41,15 @@ public class ExplosivePrimed extends Entity this.tntPlacedBy = par8EntityLivingBase; } - protected void entityInit() {} + protected void entityInit () + { + } /** * returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to * prevent them from trampling crops */ - protected boolean canTriggerWalking() + protected boolean canTriggerWalking () { return false; } @@ -55,7 +57,7 @@ public class ExplosivePrimed extends Entity /** * Returns true if other Entities should be prevented from moving through this Entity. */ - public boolean canBeCollidedWith() + public boolean canBeCollidedWith () { return !this.isDead; } @@ -63,7 +65,7 @@ public class ExplosivePrimed extends Entity /** * Called to update the entity's position/logic. */ - public void onUpdate() + public void onUpdate () { this.prevPosX = this.posX; this.prevPosY = this.posY; @@ -96,13 +98,13 @@ public class ExplosivePrimed extends Entity } } - private void explode() + private void explode () { float f = 5.0F; this.createExplosion(worldObj, this, this.posX, this.posY, this.posZ, f); } - - public void createExplosion(World world, Entity par1Entity, double par2, double par4, double par6, float par8) + + public void createExplosion (World world, Entity par1Entity, double par2, double par4, double par6, float par8) { Explosion explosion = new MiningExplosion(world, par1Entity, par2, par4, par6, par8); explosion.isFlaming = false; @@ -115,21 +117,21 @@ public class ExplosivePrimed extends Entity /** * (abstract) Protected helper method to write subclass entity data to NBT. */ - protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + protected void writeEntityToNBT (NBTTagCompound par1NBTTagCompound) { - par1NBTTagCompound.setByte("Fuse", (byte)this.fuse); + par1NBTTagCompound.setByte("Fuse", (byte) this.fuse); } /** * (abstract) Protected helper method to read subclass entity data from NBT. */ - protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + protected void readEntityFromNBT (NBTTagCompound par1NBTTagCompound) { this.fuse = par1NBTTagCompound.getByte("Fuse"); } @SideOnly(Side.CLIENT) - public float getShadowSize() + public float getShadowSize () { return 0.0F; } @@ -137,7 +139,7 @@ public class ExplosivePrimed extends Entity /** * returns null or the entityliving it was placed or ignited by */ - public EntityLivingBase getTntPlacedBy() + public EntityLivingBase getTntPlacedBy () { return this.tntPlacedBy; } diff --git a/src/tconstruct/entity/projectile/ArrowEntity.java b/src/tconstruct/entity/projectile/ArrowEntity.java index f812a57f..5990bed0 100644 --- a/src/tconstruct/entity/projectile/ArrowEntity.java +++ b/src/tconstruct/entity/projectile/ArrowEntity.java @@ -120,27 +120,27 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa { if (!worldObj.isRemote) { - int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); - int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); + int j = this.worldObj.getBlockId(this.xTile, this.yTile, this.zTile); + int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); - if (j == this.inTile && k == this.inData) - { - ++this.ticksInGround; - - if (this.ticksInGround == 120000) + if (j == this.inTile && k == this.inData) { - this.setDead(); + ++this.ticksInGround; + + if (this.ticksInGround == 120000) + { + this.setDead(); + } + } + else + { + this.inGround = false; + this.motionX *= (double) (this.rand.nextFloat() * 0.2F); + this.motionY *= (double) (this.rand.nextFloat() * 0.2F); + this.motionZ *= (double) (this.rand.nextFloat() * 0.2F); + this.ticksInGround = 0; + this.ticksInAir = 0; } - } - else - { - this.inGround = false; - this.motionX *= (double) (this.rand.nextFloat() * 0.2F); - this.motionY *= (double) (this.rand.nextFloat() * 0.2F); - this.motionZ *= (double) (this.rand.nextFloat() * 0.2F); - this.ticksInGround = 0; - this.ticksInAir = 0; - } } } else diff --git a/src/tconstruct/inventory/AdaptiveSmelteryContainer.java b/src/tconstruct/inventory/AdaptiveSmelteryContainer.java index db6dd467..6426a551 100644 --- a/src/tconstruct/inventory/AdaptiveSmelteryContainer.java +++ b/src/tconstruct/inventory/AdaptiveSmelteryContainer.java @@ -84,10 +84,10 @@ public class AdaptiveSmelteryContainer extends ActiveContainer int rowPos = (int) (total * scrollPos); return updateRows(rowPos); } - + public void updateProgressBar (int id, int value) { - + } @Override diff --git a/src/tconstruct/inventory/AdvancedDrawbridgeContainer.java b/src/tconstruct/inventory/AdvancedDrawbridgeContainer.java index 40af6fc7..c2bdc3ea 100644 --- a/src/tconstruct/inventory/AdvancedDrawbridgeContainer.java +++ b/src/tconstruct/inventory/AdvancedDrawbridgeContainer.java @@ -9,126 +9,163 @@ import net.minecraft.item.ItemStack; import tconstruct.blocks.logic.AdvancedDrawbridgeLogic; import tconstruct.client.gui.AdvDrawbridgeGui; -public class AdvancedDrawbridgeContainer extends Container { - public AdvancedDrawbridgeLogic logic; - public int progress = 0; - public int fuel = 0; - public int fuelGague = 0; +public class AdvancedDrawbridgeContainer extends Container +{ + public AdvancedDrawbridgeLogic logic; + public int progress = 0; + public int fuel = 0; + public int fuelGague = 0; - private AdvDrawbridgeGui gui = null; + private AdvDrawbridgeGui gui = null; - public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic) { - this.logic = logic; + public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic) + { + this.logic = logic; - addContainerSlots(logic); - bindPlayerInventory(inventoryplayer); - updateContainerSlots(); - } + addContainerSlots(logic); + bindPlayerInventory(inventoryplayer); + updateContainerSlots(); + } - public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic, AdvDrawbridgeGui gui) { - this.logic = logic; - this.gui = gui; + public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic, AdvDrawbridgeGui gui) + { + this.logic = logic; + this.gui = gui; - addContainerSlots(logic); - bindPlayerInventory(inventoryplayer); - updateContainerSlots(); - } + addContainerSlots(logic); + bindPlayerInventory(inventoryplayer); + updateContainerSlots(); + } - public void bindPlayerInventory(InventoryPlayer inventoryPlayer) { - for (int column = 0; column < 3; column++) { - for (int row = 0; row < 9; row++) { - this.addSlotToContainer(new Slot(inventoryPlayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18)); - } - } + public void bindPlayerInventory (InventoryPlayer inventoryPlayer) + { + for (int column = 0; column < 3; column++) + { + for (int row = 0; row < 9; row++) + { + this.addSlotToContainer(new Slot(inventoryPlayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18)); + } + } - for (int column = 0; column < 9; column++) { - this.addSlotToContainer(new Slot(inventoryPlayer, column, 8 + column * 18, 142)); - } - } + for (int column = 0; column < 9; column++) + { + this.addSlotToContainer(new Slot(inventoryPlayer, column, 8 + column * 18, 142)); + } + } - public void addContainerSlots(AdvancedDrawbridgeLogic logic) { - this.addSlotToContainer(new SlotOpaqueBlocksOnly(logic.camoInventory, 0, 35, 36)); + public void addContainerSlots (AdvancedDrawbridgeLogic logic) + { + this.addSlotToContainer(new SlotOpaqueBlocksOnly(logic.camoInventory, 0, 35, 36)); - for (int i = 0; i < logic.getSizeInventory(); i++) { - int ind = (int) (Math.floor(i / 8) * 8); - int x = i < 8 ? 10 + 20 * i : 10 + 20 * (i - 8); - int y = 35 + (int) Math.floor(i / 8) * 18 + (i < 8 ? 0 : 1); - this.addSlotToContainer(new DrawbridgeSlot(logic, i, x, y, logic)); - } - } + for (int i = 0; i < logic.getSizeInventory(); i++) + { + int ind = (int) (Math.floor(i / 8) * 8); + int x = i < 8 ? 10 + 20 * i : 10 + 20 * (i - 8); + int y = 35 + (int) Math.floor(i / 8) * 18 + (i < 8 ? 0 : 1); + this.addSlotToContainer(new DrawbridgeSlot(logic, i, x, y, logic)); + } + } - @Override - public boolean canInteractWith(EntityPlayer entityplayer) { - return logic.isUseableByPlayer(entityplayer); - } + @Override + public boolean canInteractWith (EntityPlayer entityplayer) + { + return logic.isUseableByPlayer(entityplayer); + } - @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { - ItemStack stack = null; - Slot slot = (Slot) this.inventorySlots.get(slotID); + @Override + public ItemStack transferStackInSlot (EntityPlayer player, int slotID) + { + ItemStack stack = null; + Slot slot = (Slot) this.inventorySlots.get(slotID); - if (slot != null && slot.getHasStack()) { - ItemStack slotStack = slot.getStack(); - stack = slotStack.copy(); + if (slot != null && slot.getHasStack()) + { + ItemStack slotStack = slot.getStack(); + stack = slotStack.copy(); - if (slotID < logic.getSizeInventory()) { - if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) { - return null; - } - } else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false)) { - return null; - } + if (slotID < logic.getSizeInventory()) + { + if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) + { + return null; + } + } + else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false)) + { + return null; + } - if (slotStack.stackSize == 0) { - slot.putStack((ItemStack) null); - } else { - slot.onSlotChanged(); - } - } + if (slotStack.stackSize == 0) + { + slot.putStack((ItemStack) null); + } + else + { + slot.onSlotChanged(); + } + } - return stack; - } + return stack; + } - public void updateContainerSlots() { - if (gui == null) { - return; - } else if (gui.isGuiExpanded) { - Iterator i1 = inventorySlots.iterator(); - int index = 0; - while (i1.hasNext()) { - Slot sl = i1.next(); - if (index == 0) { - sl.xDisplayPosition = -1000; - sl.yDisplayPosition = -1000; - } else if (sl instanceof DrawbridgeSlot) { - sl.xDisplayPosition = (index - 1) < 8 ? 10 + 20 * (index - 1) : 10 + 20 * ((index - 1) - 8); - sl.yDisplayPosition = 35 + (int) Math.floor((index - 1) / 8) * 18 + ((index - 1) < 8 ? 0 : 1); - } - index++; - } - } else { - Iterator i1 = inventorySlots.iterator(); - int index = 0; - while (i1.hasNext()) { - Slot sl = i1.next(); - if (index == 0) { - sl.xDisplayPosition = 35; - sl.yDisplayPosition = 36; - } else if (sl instanceof DrawbridgeSlot) { - sl.xDisplayPosition = -1000; - sl.yDisplayPosition = -1000; - } - index++; - } - } - } - - @Override - public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer par4EntityPlayer){ - if(gui != null && gui.containerNeglectMouse){ - return null; - }else{ - return super.slotClick(par1, par2, par3, par4EntityPlayer); - } - } + public void updateContainerSlots () + { + if (gui == null) + { + return; + } + else if (gui.isGuiExpanded) + { + Iterator i1 = inventorySlots.iterator(); + int index = 0; + while (i1.hasNext()) + { + Slot sl = i1.next(); + if (index == 0) + { + sl.xDisplayPosition = -1000; + sl.yDisplayPosition = -1000; + } + else if (sl instanceof DrawbridgeSlot) + { + sl.xDisplayPosition = (index - 1) < 8 ? 10 + 20 * (index - 1) : 10 + 20 * ((index - 1) - 8); + sl.yDisplayPosition = 35 + (int) Math.floor((index - 1) / 8) * 18 + ((index - 1) < 8 ? 0 : 1); + } + index++; + } + } + else + { + Iterator i1 = inventorySlots.iterator(); + int index = 0; + while (i1.hasNext()) + { + Slot sl = i1.next(); + if (index == 0) + { + sl.xDisplayPosition = 35; + sl.yDisplayPosition = 36; + } + else if (sl instanceof DrawbridgeSlot) + { + sl.xDisplayPosition = -1000; + sl.yDisplayPosition = -1000; + } + index++; + } + } + } + + @Override + public ItemStack slotClick (int par1, int par2, int par3, EntityPlayer par4EntityPlayer) + { + if (gui != null && gui.containerNeglectMouse) + { + return null; + } + else + { + return super.slotClick(par1, par2, par3, par4EntityPlayer); + } + } } diff --git a/src/tconstruct/inventory/FurnaceContainer.java b/src/tconstruct/inventory/FurnaceContainer.java index 9ba49180..9099ae75 100644 --- a/src/tconstruct/inventory/FurnaceContainer.java +++ b/src/tconstruct/inventory/FurnaceContainer.java @@ -42,7 +42,7 @@ public class FurnaceContainer extends Container } } - public void addCraftingToCrafters(ICrafting par1ICrafting) + public void addCraftingToCrafters (ICrafting par1ICrafting) { super.addCraftingToCrafters(par1ICrafting); par1ICrafting.sendProgressBarUpdate(this, 0, this.furnace.progress); @@ -53,13 +53,13 @@ public class FurnaceContainer extends Container /** * Looks for changes made in the container, sends them to every listener. */ - public void detectAndSendChanges() + public void detectAndSendChanges () { super.detectAndSendChanges(); for (int i = 0; i < this.crafters.size(); ++i) { - ICrafting icrafting = (ICrafting)this.crafters.get(i); + ICrafting icrafting = (ICrafting) this.crafters.get(i); if (this.lastCookTime != this.furnace.progress) { @@ -83,7 +83,7 @@ public class FurnaceContainer extends Container } @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) + public void updateProgressBar (int par1, int par2) { if (par1 == 0) { @@ -101,7 +101,7 @@ public class FurnaceContainer extends Container } } - public boolean canInteractWith(EntityPlayer par1EntityPlayer) + public boolean canInteractWith (EntityPlayer par1EntityPlayer) { return this.furnace.isUseableByPlayer(par1EntityPlayer); } @@ -109,10 +109,10 @@ public class FurnaceContainer extends Container /** * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + public ItemStack transferStackInSlot (EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(par2); + Slot slot = (Slot) this.inventorySlots.get(par2); if (slot != null && slot.getHasStack()) { @@ -163,7 +163,7 @@ public class FurnaceContainer extends Container if (itemstack1.stackSize == 0) { - slot.putStack((ItemStack)null); + slot.putStack((ItemStack) null); } else { diff --git a/src/tconstruct/items/ArmorPattern.java b/src/tconstruct/items/ArmorPattern.java index 3dddce1c..9ccaa385 100644 --- a/src/tconstruct/items/ArmorPattern.java +++ b/src/tconstruct/items/ArmorPattern.java @@ -11,40 +11,47 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; -public class ArmorPattern extends CraftingItem implements ItemBlocklike{ +public class ArmorPattern extends CraftingItem implements ItemBlocklike +{ - private Icon baseIcon; - - public ArmorPattern(int id, String partType, String patternType, String folder) { - super(id, patternName, getPatternNames(patternType), folder); + private Icon baseIcon; + + public ArmorPattern(int id, String partType, String patternType, String folder) + { + super(id, patternName, getPatternNames(patternType), folder); this.setHasSubtypes(true); this.setMaxDamage(0); this.setContainerItem(this); this.setMaxStackSize(1); - } - - protected static String[] getPatternNames (String partType){ + } + + protected static String[] getPatternNames (String partType) + { String[] names = new String[patternName.length]; for (int i = 0; i < patternName.length; i++) names[i] = partType + patternName[i]; return names; } - - public Icon getBaseIcon(){ - return baseIcon; + + public Icon getBaseIcon () + { + return baseIcon; } - + @SideOnly(Side.CLIENT) @Override - public void registerIcons (IconRegister iconRegister){ + public void registerIcons (IconRegister iconRegister) + { super.registerIcons(iconRegister); baseIcon = iconRegister.registerIcon("tinker:" + folder + "armor_cast"); } - + private static final String[] patternName = new String[] { "helmet", "chestplate", "leggings", "boots" }; - public void getSubItems (int id, CreativeTabs tab, List list){ - for (int i = 0; i < patternName.length; i++){ + public void getSubItems (int id, CreativeTabs tab, List list) + { + for (int i = 0; i < patternName.length; i++) + { list.add(new ItemStack(id, 1, i)); } } diff --git a/src/tconstruct/items/Jerky.java b/src/tconstruct/items/Jerky.java index adcc4e9f..52df9466 100644 --- a/src/tconstruct/items/Jerky.java +++ b/src/tconstruct/items/Jerky.java @@ -23,7 +23,7 @@ public class Jerky extends SpecialFood @SideOnly(Side.CLIENT) @Override - public void registerIcons(IconRegister iconRegister) + public void registerIcons (IconRegister iconRegister) { this.icons = new Icon[iconNames.length]; @@ -33,7 +33,6 @@ public class Jerky extends SpecialFood } } - public String getUnlocalizedName (ItemStack stack) { int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length); diff --git a/src/tconstruct/items/LengthWire.java b/src/tconstruct/items/LengthWire.java index a5255301..e5499ed5 100644 --- a/src/tconstruct/items/LengthWire.java +++ b/src/tconstruct/items/LengthWire.java @@ -19,7 +19,6 @@ public class LengthWire extends Item public String folder = "logic/"; public Icon[] icons; - public LengthWire(int id) { super(id); @@ -28,7 +27,6 @@ public class LengthWire extends Item this.setHasSubtypes(false); } - @SideOnly(Side.CLIENT) public Icon getIconFromDamage (int meta) { diff --git a/src/tconstruct/items/SpoolOfWire.java b/src/tconstruct/items/SpoolOfWire.java index 342878c2..fda8e7c3 100644 --- a/src/tconstruct/items/SpoolOfWire.java +++ b/src/tconstruct/items/SpoolOfWire.java @@ -56,7 +56,7 @@ public class SpoolOfWire extends Item { return "item." + unlocalizedName; } - + @Override public boolean onItemUse (ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) { @@ -87,7 +87,7 @@ public class SpoolOfWire extends Item int calc = Math.abs(targetX - x) + Math.abs(targetY - y) + Math.abs(targetZ - z); if ((itemstack.getMaxDamage() - itemstack.getItemDamage()) < calc) - { + { return false; } if (targetDim == world.provider.dimensionId && calc < 16) diff --git a/src/tconstruct/items/armor/ArmorBasic.java b/src/tconstruct/items/armor/ArmorBasic.java index 2f3c7522..05c3caf4 100644 --- a/src/tconstruct/items/armor/ArmorBasic.java +++ b/src/tconstruct/items/armor/ArmorBasic.java @@ -4,22 +4,27 @@ import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.item.*; -public class ArmorBasic extends ItemArmor { +public class ArmorBasic extends ItemArmor +{ - public String textureName; - - public ArmorBasic(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, String textureName) { - super(par1, par2EnumArmorMaterial, 0, par3); - this.textureName = textureName; - } - - @Override - public void registerIcons(IconRegister par1IconRegister){ - this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_" + (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet")); - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer){ + public String textureName; + + public ArmorBasic(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, String textureName) + { + super(par1, par2EnumArmorMaterial, 0, par3); + this.textureName = textureName; + } + + @Override + public void registerIcons (IconRegister par1IconRegister) + { + this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_" + + (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet")); + } + + @Override + public String getArmorTexture (ItemStack stack, Entity entity, int slot, int layer) + { return "tinker:textures/armor/" + textureName + "_" + layer + ".png"; } diff --git a/src/tconstruct/items/armor/ArmorStandard.java b/src/tconstruct/items/armor/ArmorStandard.java index af9ee384..ed0cece1 100644 --- a/src/tconstruct/items/armor/ArmorStandard.java +++ b/src/tconstruct/items/armor/ArmorStandard.java @@ -6,20 +6,24 @@ import net.minecraft.item.ItemStack; import net.minecraft.client.renderer.texture.IconRegister; import tconstruct.library.armor.*; -public class ArmorStandard extends ArmorCore{ +public class ArmorStandard extends ArmorCore +{ - public ArmorStandard(int par1, int baseProtection, EnumArmorPart armorPart) { - super(par1, baseProtection, armorPart); - } + public ArmorStandard(int par1, int baseProtection, EnumArmorPart armorPart) + { + super(par1, baseProtection, armorPart); + } - @Override - public void registerIcons(IconRegister par1IconRegister){ - this.itemIcon = par1IconRegister.registerIcon("tinker:armor/wood_helmet"); - } - - @Override - public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer){ + @Override + public void registerIcons (IconRegister par1IconRegister) + { + this.itemIcon = par1IconRegister.registerIcon("tinker:armor/wood_helmet"); + } + + @Override + public String getArmorTexture (ItemStack stack, Entity entity, int slot, int layer) + { return "tinker:textures/armor/wood_" + layer + ".png"; } - + } \ No newline at end of file diff --git a/src/tconstruct/items/blocks/SignalBusItem.java b/src/tconstruct/items/blocks/SignalBusItem.java index 401fefeb..2a9d54dc 100644 --- a/src/tconstruct/items/blocks/SignalBusItem.java +++ b/src/tconstruct/items/blocks/SignalBusItem.java @@ -38,7 +38,6 @@ public class SignalBusItem extends ItemBlock int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1); return (new StringBuilder()).append("tile.").append(blockType[pos]).toString(); } - @Override @SideOnly(Side.CLIENT) @@ -93,7 +92,7 @@ public class SignalBusItem extends ItemBlock tside = side; break; } - + NBTTagCompound data = new NBTTagCompound(); stack.stackTagCompound = data; data.setInteger("connectedSide", tside); @@ -112,13 +111,13 @@ public class SignalBusItem extends ItemBlock TileEntity te = world.getBlockTileEntity(tmpX, tmpY, tmpZ); ((SignalBusLogic) te).addPlacedSide(tside); - + stack.stackTagCompound = null; - + --stack.stackSize; - + world.markBlockForRenderUpdate(x, y, z); - + return true; } @@ -178,7 +177,7 @@ public class SignalBusItem extends ItemBlock return false; } - return ((SignalBusLogic)te).canPlaceOnSide(ForgeDirection.OPPOSITES[side]); + return ((SignalBusLogic) te).canPlaceOnSide(ForgeDirection.OPPOSITES[side]); } return false; diff --git a/src/tconstruct/items/blocks/SignalTerminalItem.java b/src/tconstruct/items/blocks/SignalTerminalItem.java index 47100225..0ce5da2c 100644 --- a/src/tconstruct/items/blocks/SignalTerminalItem.java +++ b/src/tconstruct/items/blocks/SignalTerminalItem.java @@ -119,13 +119,13 @@ public class SignalTerminalItem extends ItemBlock ((SignalTerminalLogic) te).addPendingSide(tside); ((SignalTerminalLogic) te).connectPending(); - + stack.stackTagCompound = null; --stack.stackSize; - + world.markBlockForRenderUpdate(x, y, z); - + return true; } diff --git a/src/tconstruct/items/blocks/TerraformerItem.java b/src/tconstruct/items/blocks/TerraformerItem.java index d7fe7c0a..bd011735 100644 --- a/src/tconstruct/items/blocks/TerraformerItem.java +++ b/src/tconstruct/items/blocks/TerraformerItem.java @@ -12,6 +12,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class TerraformerItem extends ItemBlock { static String blockType[] = { "freezer", "fumer", "waver", "leecher", "grower", "nether", "lighter", "crystal" }; + //static String[] textureNames = { "crystal_machine_top", "terrafreezer", "terrafumer", "terrawaver", "terraleecher", "terragrower", "terranether", "terralighter", "terracrystal" }; public TerraformerItem(int id) diff --git a/src/tconstruct/items/tools/Battleaxe.java b/src/tconstruct/items/tools/Battleaxe.java index fe9edb20..fe98e10a 100644 --- a/src/tconstruct/items/tools/Battleaxe.java +++ b/src/tconstruct/items/tools/Battleaxe.java @@ -300,19 +300,22 @@ public class Battleaxe extends HarvestTool world.playAuxSFX(2001, x, y, z, woodID + (meta << 12)); return super.onBlockStartBreak(stack, x, y, z, player); } - - @Override - public boolean willAllowOffhandWeapon() { - return false; - } - - @Override - public boolean willAllowShield() { - return false; - } - - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + + @Override + public boolean willAllowOffhandWeapon () + { + return false; + } + + @Override + public boolean willAllowShield () + { + return false; + } + + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } } diff --git a/src/tconstruct/items/tools/Chisel.java b/src/tconstruct/items/tools/Chisel.java index 0b012a82..b9c0b761 100644 --- a/src/tconstruct/items/tools/Chisel.java +++ b/src/tconstruct/items/tools/Chisel.java @@ -226,18 +226,21 @@ public class Chisel extends ToolCore return new String[] { "utility" }; } - @Override - public boolean willAllowOffhandWeapon() { - return false; - } + @Override + public boolean willAllowOffhandWeapon () + { + return false; + } - @Override - public boolean willAllowShield() { - return false; - } + @Override + public boolean willAllowShield () + { + return false; + } - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } } diff --git a/src/tconstruct/items/tools/Cleaver.java b/src/tconstruct/items/tools/Cleaver.java index a80b7c71..d0948202 100644 --- a/src/tconstruct/items/tools/Cleaver.java +++ b/src/tconstruct/items/tools/Cleaver.java @@ -162,24 +162,28 @@ public class Cleaver extends Weapon entity.swingProgressInt /= 2; return false; }*/ - + @Override - public boolean willAllowOffhandWeapon() { - return false; - } + public boolean willAllowOffhandWeapon () + { + return false; + } - @Override - public boolean willAllowShield() { - return PHConstruct.isCleaverTwoHanded; - } + @Override + public boolean willAllowShield () + { + return PHConstruct.isCleaverTwoHanded; + } - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } - @Override - public boolean sheatheOnBack() { - return true; - } + @Override + public boolean sheatheOnBack () + { + return true; + } } diff --git a/src/tconstruct/items/tools/Excavator.java b/src/tconstruct/items/tools/Excavator.java index d6bd8288..1ccdfe72 100644 --- a/src/tconstruct/items/tools/Excavator.java +++ b/src/tconstruct/items/tools/Excavator.java @@ -293,24 +293,28 @@ public class Excavator extends HarvestTool } return super.getStrVsBlock(stack, block, meta); } - + @Override - public boolean willAllowOffhandWeapon() { - return false; - } + public boolean willAllowOffhandWeapon () + { + return false; + } - @Override - public boolean willAllowShield() { - return false; - } + @Override + public boolean willAllowShield () + { + return false; + } - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } - @Override - public boolean sheatheOnBack() { - return true; - } + @Override + public boolean sheatheOnBack () + { + return true; + } } diff --git a/src/tconstruct/items/tools/Hammer.java b/src/tconstruct/items/tools/Hammer.java index 159f7ca2..399aee1b 100644 --- a/src/tconstruct/items/tools/Hammer.java +++ b/src/tconstruct/items/tools/Hammer.java @@ -397,19 +397,22 @@ public class Hammer extends HarvestTool { return new String[] { "weapon", "harvest", "melee", "bludgeoning" }; } - + @Override - public boolean willAllowOffhandWeapon() { - return false; - } + public boolean willAllowOffhandWeapon () + { + return false; + } - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } - @Override - public boolean sheatheOnBack() { - return true; - } + @Override + public boolean sheatheOnBack () + { + return true; + } } diff --git a/src/tconstruct/items/tools/Hatchet.java b/src/tconstruct/items/tools/Hatchet.java index 32a10158..abf57990 100644 --- a/src/tconstruct/items/tools/Hatchet.java +++ b/src/tconstruct/items/tools/Hatchet.java @@ -105,9 +105,10 @@ public class Hatchet extends HarvestTool { return "axe"; } - - @Override - public boolean isOffhandHandDualWeapon() { - return PHConstruct.isHatchetWeapon; - } + + @Override + public boolean isOffhandHandDualWeapon () + { + return PHConstruct.isHatchetWeapon; + } } diff --git a/src/tconstruct/items/tools/LumberAxe.java b/src/tconstruct/items/tools/LumberAxe.java index 78119489..6087ad2d 100644 --- a/src/tconstruct/items/tools/LumberAxe.java +++ b/src/tconstruct/items/tools/LumberAxe.java @@ -400,24 +400,28 @@ public class LumberAxe extends HarvestTool { return 1; } - + @Override - public boolean willAllowOffhandWeapon() { - return false; - } + public boolean willAllowOffhandWeapon () + { + return false; + } - @Override - public boolean willAllowShield() { - return false; - } + @Override + public boolean willAllowShield () + { + return false; + } - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } - @Override - public boolean sheatheOnBack() { - return true; - } + @Override + public boolean sheatheOnBack () + { + return true; + } } diff --git a/src/tconstruct/items/tools/Pickaxe.java b/src/tconstruct/items/tools/Pickaxe.java index ac2ed5ff..6388c83d 100644 --- a/src/tconstruct/items/tools/Pickaxe.java +++ b/src/tconstruct/items/tools/Pickaxe.java @@ -68,9 +68,10 @@ public class Pickaxe extends HarvestTool { return "pickaxe"; } - - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } } diff --git a/src/tconstruct/items/tools/Scythe.java b/src/tconstruct/items/tools/Scythe.java index 0a5f986c..75619d91 100644 --- a/src/tconstruct/items/tools/Scythe.java +++ b/src/tconstruct/items/tools/Scythe.java @@ -219,22 +219,26 @@ public class Scythe extends Weapon } @Override - public boolean willAllowOffhandWeapon() { - return false; - } + public boolean willAllowOffhandWeapon () + { + return false; + } - @Override - public boolean willAllowShield() { - return false; - } + @Override + public boolean willAllowShield () + { + return false; + } - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } - @Override - public boolean sheatheOnBack() { - return true; - } + @Override + public boolean sheatheOnBack () + { + return true; + } } diff --git a/src/tconstruct/items/tools/Shortbow.java b/src/tconstruct/items/tools/Shortbow.java index 7ae35b45..3df3735c 100644 --- a/src/tconstruct/items/tools/Shortbow.java +++ b/src/tconstruct/items/tools/Shortbow.java @@ -190,24 +190,28 @@ public class Shortbow extends BowBase } //return TConstructRegistry.getMaterial(type).ability(); } - + @Override - public boolean willAllowOffhandWeapon() { - return false; - } + public boolean willAllowOffhandWeapon () + { + return false; + } - @Override - public boolean willAllowShield() { - return false; - } + @Override + public boolean willAllowShield () + { + return false; + } - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } - @Override - public boolean sheatheOnBack() { - return true; - } + @Override + public boolean sheatheOnBack () + { + return true; + } } diff --git a/src/tconstruct/items/tools/Shovel.java b/src/tconstruct/items/tools/Shovel.java index 255000de..78ebbc14 100644 --- a/src/tconstruct/items/tools/Shovel.java +++ b/src/tconstruct/items/tools/Shovel.java @@ -89,11 +89,12 @@ public class Shovel extends HarvestTool { return "shovel"; } - - @Override - public boolean isOffhandHandDualWeapon() { - return false; - } + + @Override + public boolean isOffhandHandDualWeapon () + { + return false; + } /*@Override public Icon getIcon (ItemStack stack, int renderPass) diff --git a/src/tconstruct/library/ItemBlocklike.java b/src/tconstruct/library/ItemBlocklike.java index 4e479445..46375dbe 100644 --- a/src/tconstruct/library/ItemBlocklike.java +++ b/src/tconstruct/library/ItemBlocklike.java @@ -1,3 +1,5 @@ package tconstruct.library; -public interface ItemBlocklike {} +public interface ItemBlocklike +{ +} diff --git a/src/tconstruct/library/armor/ArmorCore.java b/src/tconstruct/library/armor/ArmorCore.java index 74e7ab24..108c174d 100644 --- a/src/tconstruct/library/armor/ArmorCore.java +++ b/src/tconstruct/library/armor/ArmorCore.java @@ -15,269 +15,321 @@ import net.minecraftforge.common.ISpecialArmor; * NBTTags * Main tag - InfiArmor */ -public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem, IBoxable, ISpecialArmor { +public abstract class ArmorCore extends ItemArmor implements ICustomElectricItem, IBoxable, ISpecialArmor +{ - public static final String SET_NAME = "InfiArmor"; - public final EnumArmorPart armorPart; - private static final IBehaviorDispenseItem dispenserBehavior = new BehaviorDispenseArmorCopy(); - public final int baseProtection; + public static final String SET_NAME = "InfiArmor"; + public final EnumArmorPart armorPart; + private static final IBehaviorDispenseItem dispenserBehavior = new BehaviorDispenseArmorCopy(); + public final int baseProtection; - public ArmorCore(int par1, int baseProtection, EnumArmorPart part) { - super(par1, EnumArmorMaterial.CHAIN, 0, 0); - this.maxStackSize = 1; - this.setMaxDamage(100); - this.setUnlocalizedName(SET_NAME); - this.armorPart = part; - this.baseProtection = baseProtection; - BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior); - } + public ArmorCore(int par1, int baseProtection, EnumArmorPart part) + { + super(par1, EnumArmorMaterial.CHAIN, 0, 0); + this.maxStackSize = 1; + this.setMaxDamage(100); + this.setUnlocalizedName(SET_NAME); + this.armorPart = part; + this.baseProtection = baseProtection; + BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserBehavior); + } - public String getArmorName() { - return this.getClass().getSimpleName(); - } + public String getArmorName () + { + return this.getClass().getSimpleName(); + } - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { - int i = EntityLiving.getArmorPosition(par1ItemStack) - 1; - ItemStack itemstack1 = par3EntityPlayer.getCurrentArmor(i); + public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) + { + int i = EntityLiving.getArmorPosition(par1ItemStack) - 1; + ItemStack itemstack1 = par3EntityPlayer.getCurrentArmor(i); - if (itemstack1 == null) { - par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. - par1ItemStack.stackSize = 0; - } + if (itemstack1 == null) + { + par3EntityPlayer.setCurrentItemOrArmor(i + 1, par1ItemStack.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + par1ItemStack.stackSize = 0; + } - return par1ItemStack; - } + return par1ItemStack; + } - //ISpecialArmor overrides - @Override - public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { - NBTTagCompound tags = armor.getTagCompound(); + //ISpecialArmor overrides + @Override + public ArmorProperties getProperties (EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) + { + NBTTagCompound tags = armor.getTagCompound(); - if (tags == null) { - return new ArmorProperties(0, damage / baseProtection, baseProtection); - } + if (tags == null) + { + return new ArmorProperties(0, damage / baseProtection, baseProtection); + } - NBTTagCompound data = tags.getCompoundTag(SET_NAME); + NBTTagCompound data = tags.getCompoundTag(SET_NAME); - return new ArmorProperties(0, data.getInteger("damageReduction") / damage, data.getInteger("maxAbsorb")); - } + return new ArmorProperties(0, data.getInteger("damageReduction") / damage, data.getInteger("maxAbsorb")); + } - @Override - public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { - return armor.getTagCompound() != null && armor.getTagCompound().getCompoundTag(SET_NAME) != null ? armor.getTagCompound().getCompoundTag(SET_NAME).getInteger("maxAbsorb") : this.baseProtection; - } + @Override + public int getArmorDisplay (EntityPlayer player, ItemStack armor, int slot) + { + return armor.getTagCompound() != null && armor.getTagCompound().getCompoundTag(SET_NAME) != null ? armor.getTagCompound().getCompoundTag(SET_NAME).getInteger("maxAbsorb") + : this.baseProtection; + } - @Override - public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { - NBTTagCompound tags = stack.getTagCompound(); - NBTTagCompound data; + @Override + public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) + { + NBTTagCompound tags = stack.getTagCompound(); + NBTTagCompound data; - if (tags == null) { - tags = new NBTTagCompound(); - stack.setTagCompound(tags); - data = new NBTTagCompound(); - tags.setCompoundTag(SET_NAME, data); - data.setInteger("damageReduction", baseProtection); - data.setInteger("maxAbsorb", baseProtection); - } + if (tags == null) + { + tags = new NBTTagCompound(); + stack.setTagCompound(tags); + data = new NBTTagCompound(); + tags.setCompoundTag(SET_NAME, data); + data.setInteger("damageReduction", baseProtection); + data.setInteger("maxAbsorb", baseProtection); + } - data = tags.getCompoundTag(SET_NAME); + data = tags.getCompoundTag(SET_NAME); - if (tags.hasKey("charge")) { - int charge = tags.getInteger("charge"); - if (charge > damage) { - charge -= damage; - tags.setInteger("charge", charge); - return; - } else { - damage -= charge; - tags.setInteger("charge", 0); - int dmg = data.getInteger("Damage"); - dmg += damage; - data.setInteger("Damage", dmg); - } + if (tags.hasKey("charge")) + { + int charge = tags.getInteger("charge"); + if (charge > damage) + { + charge -= damage; + tags.setInteger("charge", charge); + return; + } + else + { + damage -= charge; + tags.setInteger("charge", 0); + int dmg = data.getInteger("Damage"); + dmg += damage; + data.setInteger("Damage", dmg); + } - } else { - int dmg = data.getInteger("Damage"); - dmg += damage; - data.setInteger("Damage", dmg); - } - } + } + else + { + int dmg = data.getInteger("Damage"); + dmg += damage; + data.setInteger("Damage", dmg); + } + } - /* - * IC2 API support - */ + /* + * IC2 API support + */ - @Override - public boolean canBeStoredInToolbox(ItemStack stack) { - return true; - } + @Override + public boolean canBeStoredInToolbox (ItemStack stack) + { + return true; + } - @Override - public boolean canProvideEnergy(ItemStack stack) { - NBTTagCompound tags = stack.getTagCompound(); + @Override + public boolean canProvideEnergy (ItemStack stack) + { + NBTTagCompound tags = stack.getTagCompound(); - return tags.hasKey("charge"); - } + return tags.hasKey("charge"); + } - @Override - public int getChargedItemId(ItemStack stack) { - return this.itemID; - } + @Override + public int getChargedItemId (ItemStack stack) + { + return this.itemID; + } - @Override - public int getEmptyItemId(ItemStack stack) { - return this.itemID; - } + @Override + public int getEmptyItemId (ItemStack stack) + { + return this.itemID; + } - @Override - public int getMaxCharge(ItemStack stack) { - NBTTagCompound tags = stack.getTagCompound(); - return tags.hasKey("charge") ? 10000 : 0; - } + @Override + public int getMaxCharge (ItemStack stack) + { + NBTTagCompound tags = stack.getTagCompound(); + return tags.hasKey("charge") ? 10000 : 0; + } - @Override - public int getTier(ItemStack stack) { - return 0; - } + @Override + public int getTier (ItemStack stack) + { + return 0; + } - @Override - public int getTransferLimit(ItemStack stack) { - NBTTagCompound tags = stack.getTagCompound(); + @Override + public int getTransferLimit (ItemStack stack) + { + NBTTagCompound tags = stack.getTagCompound(); - return tags.hasKey("charge") ? 32 : 0; - } + return tags.hasKey("charge") ? 32 : 0; + } - @Override - public int charge(ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { - NBTTagCompound tags = stack.getTagCompound(); - if (!tags.hasKey("charge")) { - return 0; - } + @Override + public int charge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) + { + NBTTagCompound tags = stack.getTagCompound(); + if (!tags.hasKey("charge")) + { + return 0; + } - if (amount > 0) { - if (amount > getTransferLimit(stack) && !ignoreTransferLimit) { - amount = getTransferLimit(stack); - } + if (amount > 0) + { + if (amount > getTransferLimit(stack) && !ignoreTransferLimit) + { + amount = getTransferLimit(stack); + } - int charge = tags.getInteger("charge"); + int charge = tags.getInteger("charge"); - if (amount > getMaxCharge(stack)) { - amount = getMaxCharge(stack); - } + if (amount > getMaxCharge(stack)) + { + amount = getMaxCharge(stack); + } - charge += amount; + charge += amount; - if (!simulate) { - tags.setInteger("charge", charge); - stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / getMaxCharge(stack)); - } - return amount; - } + if (!simulate) + { + tags.setInteger("charge", charge); + stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 2) / getMaxCharge(stack)); + } + return amount; + } - else - return 0; - } + else + return 0; + } - @Override - public int discharge(ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) { - NBTTagCompound tags = stack.getTagCompound(); - if (!tags.hasKey("charge")) { - return 0; - } + @Override + public int discharge (ItemStack stack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate) + { + NBTTagCompound tags = stack.getTagCompound(); + if (!tags.hasKey("charge")) + { + return 0; + } - if (amount > 0) { - if (amount > getTransferLimit(stack)) { - amount = getTransferLimit(stack); - } + if (amount > 0) + { + if (amount > getTransferLimit(stack)) + { + amount = getTransferLimit(stack); + } - int charge = tags.getInteger("charge"); + int charge = tags.getInteger("charge"); - if (amount > charge) { - amount = charge; - } + if (amount > charge) + { + amount = charge; + } - charge -= amount; + charge -= amount; - if (!simulate) { - tags.setInteger("charge", charge); - stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / getMaxCharge(stack)); - } + if (!simulate) + { + tags.setInteger("charge", charge); + stack.setItemDamage(1 + (getMaxCharge(stack) - charge) * (stack.getMaxDamage() - 1) / getMaxCharge(stack)); + } - return charge; - } + return charge; + } - else - return 0; - } + else + return 0; + } - @Override - public boolean canUse(ItemStack stack, int amount) { - return false; - } + @Override + public boolean canUse (ItemStack stack, int amount) + { + return false; + } - @Override - public boolean canShowChargeToolTip(ItemStack stack) { - return false; - } + @Override + public boolean canShowChargeToolTip (ItemStack stack) + { + return false; + } - // Vanilla overrides - public boolean isItemTool(ItemStack par1ItemStack) { - return false; - } + // Vanilla overrides + public boolean isItemTool (ItemStack par1ItemStack) + { + return false; + } - @Override - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { - return false; - } + @Override + public boolean getIsRepairable (ItemStack par1ItemStack, ItemStack par2ItemStack) + { + return false; + } - public boolean isRepairable() { - return false; - } + public boolean isRepairable () + { + return false; + } - public int getItemEnchantability() { - return 0; - } + public int getItemEnchantability () + { + return 0; + } - public boolean isFull3D() { - return true; - } + public boolean isFull3D () + { + return true; + } - public boolean isValidArmor(ItemStack stack, int armorType, Entity entity) { - return this.armorPart.getPartId() == armorType; - } + public boolean isValidArmor (ItemStack stack, int armorType, Entity entity) + { + return this.armorPart.getPartId() == armorType; + } - /* Proper stack damage */ - public int getItemMaxDamageFromStack(ItemStack stack) { - NBTTagCompound tags = stack.getTagCompound(); - if (tags == null) { - return 0; - } + /* Proper stack damage */ + public int getItemMaxDamageFromStack (ItemStack stack) + { + NBTTagCompound tags = stack.getTagCompound(); + if (tags == null) + { + return 0; + } - if (tags.hasKey("charge")) { - int charge = tags.getInteger("charge"); - if (charge > 0) { - return this.getMaxCharge(stack); - } - } + if (tags.hasKey("charge")) + { + int charge = tags.getInteger("charge"); + if (charge > 0) + { + return this.getMaxCharge(stack); + } + } - return tags.getCompoundTag(SET_NAME).getInteger("TotalDurability"); - } + return tags.getCompoundTag(SET_NAME).getInteger("TotalDurability"); + } - public int getItemMaxDamageFromStackForDisplay(ItemStack stack) { - NBTTagCompound tags = stack.getTagCompound(); - if (tags == null) { - return 0; - } + public int getItemMaxDamageFromStackForDisplay (ItemStack stack) + { + NBTTagCompound tags = stack.getTagCompound(); + if (tags == null) + { + return 0; + } - if (tags.hasKey("charge")) { - int charge = tags.getInteger("charge"); - if (charge > 0) { - return this.getMaxCharge(stack) - charge; - } - } + if (tags.hasKey("charge")) + { + int charge = tags.getInteger("charge"); + if (charge > 0) + { + return this.getMaxCharge(stack) - charge; + } + } - return tags.getCompoundTag(SET_NAME).getInteger("Damage"); - } + return tags.getCompoundTag(SET_NAME).getInteger("Damage"); + } } \ No newline at end of file diff --git a/src/tconstruct/library/armor/BehaviorDispenseArmorCopy.java b/src/tconstruct/library/armor/BehaviorDispenseArmorCopy.java index 4389496d..147f014d 100644 --- a/src/tconstruct/library/armor/BehaviorDispenseArmorCopy.java +++ b/src/tconstruct/library/armor/BehaviorDispenseArmorCopy.java @@ -18,27 +18,27 @@ final class BehaviorDispenseArmorCopy extends BehaviorDefaultDispenseItem /** * Dispense the specified stack, play the dispense sound and spawn particles. */ - protected ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) + protected ItemStack dispenseStack (IBlockSource par1IBlockSource, ItemStack par2ItemStack) { EnumFacing enumfacing = BlockDispenser.getFacing(par1IBlockSource.getBlockMetadata()); int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX(); int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY(); int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ(); - AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double)i, (double)j, (double)k, (double)(i + 1), (double)(j + 1), (double)(k + 1)); + AxisAlignedBB axisalignedbb = AxisAlignedBB.getAABBPool().getAABB((double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1)); List list = par1IBlockSource.getWorld().selectEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb, new EntitySelectorArmoredMob(par2ItemStack)); if (list.size() > 0) { - EntityLivingBase entitylivingbase = (EntityLivingBase)list.get(0); + EntityLivingBase entitylivingbase = (EntityLivingBase) list.get(0); int l = entitylivingbase instanceof EntityPlayer ? 1 : 0; int i1 = EntityLiving.getArmorPosition(par2ItemStack); ItemStack itemstack1 = par2ItemStack.copy(); itemstack1.stackSize = 1; - entitylivingbase.setCurrentItemOrArmor(i1, itemstack1); //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. + entitylivingbase.setCurrentItemOrArmor(i1, itemstack1); //BUGFIX Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players. if (entitylivingbase instanceof EntityLiving) { - ((EntityLiving)entitylivingbase).setEquipmentDropChance(i1, 2.0F); + ((EntityLiving) entitylivingbase).setEquipmentDropChance(i1, 2.0F); } --par2ItemStack.stackSize; diff --git a/src/tconstruct/library/armor/EnumArmorPart.java b/src/tconstruct/library/armor/EnumArmorPart.java index d60d6cbc..daccd220 100644 --- a/src/tconstruct/library/armor/EnumArmorPart.java +++ b/src/tconstruct/library/armor/EnumArmorPart.java @@ -1,16 +1,19 @@ package tconstruct.library.armor; -public enum EnumArmorPart { +public enum EnumArmorPart +{ - HELMET(0), CHESTPLATE(1), LEGGINGS(2), BOOTS(3); + HELMET(0), CHESTPLATE(1), LEGGINGS(2), BOOTS(3); - private final int partID; + private final int partID; - private EnumArmorPart(int partID) { - this.partID = partID; - } + private EnumArmorPart(int partID) + { + this.partID = partID; + } - public int getPartId() { - return this.partID; - } + public int getPartId () + { + return this.partID; + } } \ No newline at end of file diff --git a/src/tconstruct/library/blocks/ExpandableInventoryLogic.java b/src/tconstruct/library/blocks/ExpandableInventoryLogic.java index 5bc13e71..002b08e5 100644 --- a/src/tconstruct/library/blocks/ExpandableInventoryLogic.java +++ b/src/tconstruct/library/blocks/ExpandableInventoryLogic.java @@ -7,168 +7,211 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.*; import net.minecraft.world.World; -public abstract class ExpandableInventoryLogic extends InventoryLogic implements IInventory { +public abstract class ExpandableInventoryLogic extends InventoryLogic implements IInventory +{ - public ExpandableInventoryLogic() { - super(0); - } + public ExpandableInventoryLogic() + { + super(0); + } - protected ArrayList inventory = new ArrayList(); - protected String invName; + protected ArrayList inventory = new ArrayList(); + protected String invName; - @Override - public ItemStack getStackInSlot(int slot) { - return slot < inventory.size() ? inventory.get(slot) : null; - } + @Override + public ItemStack getStackInSlot (int slot) + { + return slot < inventory.size() ? inventory.get(slot) : null; + } - public boolean isStackInSlot(int slot) { - return slot < inventory.size() && inventory.get(slot) != null; - } + public boolean isStackInSlot (int slot) + { + return slot < inventory.size() && inventory.get(slot) != null; + } - @Override - public int getSizeInventory() { - return inventory.size(); - } + @Override + public int getSizeInventory () + { + return inventory.size(); + } - public int getMaxSize() { - return 64; - } + public int getMaxSize () + { + return 64; + } - @Override - public int getInventoryStackLimit() { - return 64; - } + @Override + public int getInventoryStackLimit () + { + return 64; + } - public boolean canDropInventorySlot(int slot) { - return true; - } + public boolean canDropInventorySlot (int slot) + { + return true; + } - @Override - public void setInventorySlotContents(int slot, ItemStack itemstack) { - if (slot < inventory.size()) { - inventory.set(slot, itemstack); - } else if (slot == inventory.size()) { - inventory.add(itemstack); - } else if (slot < getMaxSize()) { - inventory.ensureCapacity(slot); - inventory.set(slot, itemstack); - } else { - return; - } - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) { - itemstack.stackSize = getInventoryStackLimit(); - } - } + @Override + public void setInventorySlotContents (int slot, ItemStack itemstack) + { + if (slot < inventory.size()) + { + inventory.set(slot, itemstack); + } + else if (slot == inventory.size()) + { + inventory.add(itemstack); + } + else if (slot < getMaxSize()) + { + inventory.ensureCapacity(slot); + inventory.set(slot, itemstack); + } + else + { + return; + } + if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) + { + itemstack.stackSize = getInventoryStackLimit(); + } + } - @Override - public ItemStack decrStackSize(int slot, int quantity) { - if (slot < inventory.size() && inventory.get(slot) != null) { - if (inventory.get(slot).stackSize <= quantity) { - ItemStack stack = inventory.get(slot); - inventory.set(slot, null); - return stack; - } - ItemStack split = inventory.get(slot).splitStack(quantity); - if (inventory.get(slot).stackSize == 0) { - inventory.set(slot, null); - } - return split; - } else { - return null; - } - } + @Override + public ItemStack decrStackSize (int slot, int quantity) + { + if (slot < inventory.size() && inventory.get(slot) != null) + { + if (inventory.get(slot).stackSize <= quantity) + { + ItemStack stack = inventory.get(slot); + inventory.set(slot, null); + return stack; + } + ItemStack split = inventory.get(slot).splitStack(quantity); + if (inventory.get(slot).stackSize == 0) + { + inventory.set(slot, null); + } + return split; + } + else + { + return null; + } + } - /* Supporting methods */ - @Override - public boolean isUseableByPlayer(EntityPlayer entityplayer) { - if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this) - return false; + /* Supporting methods */ + @Override + public boolean isUseableByPlayer (EntityPlayer entityplayer) + { + if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this) + return false; - else - return entityplayer.getDistance((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D; + else + return entityplayer.getDistance((double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D; - } + } - public abstract Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z); + public abstract Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z); - /* NBT */ - @Override - public void readFromNBT(NBTTagCompound tags) { - super.readFromNBT(tags); - this.invName = tags.getString("InvName"); - NBTTagList nbttaglist = tags.getTagList("Items"); - inventory = new ArrayList(); - inventory.ensureCapacity(nbttaglist.tagCount() > getMaxSize() ? getMaxSize() : nbttaglist.tagCount()); - for (int iter = 0; iter < nbttaglist.tagCount(); iter++) { - NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter); - byte slotID = tagList.getByte("Slot"); - if (slotID >= 0 && slotID < inventory.size()) { - inventory.set(slotID, ItemStack.loadItemStackFromNBT(tagList)); - } - } - } + /* NBT */ + @Override + public void readFromNBT (NBTTagCompound tags) + { + super.readFromNBT(tags); + this.invName = tags.getString("InvName"); + NBTTagList nbttaglist = tags.getTagList("Items"); + inventory = new ArrayList(); + inventory.ensureCapacity(nbttaglist.tagCount() > getMaxSize() ? getMaxSize() : nbttaglist.tagCount()); + for (int iter = 0; iter < nbttaglist.tagCount(); iter++) + { + NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter); + byte slotID = tagList.getByte("Slot"); + if (slotID >= 0 && slotID < inventory.size()) + { + inventory.set(slotID, ItemStack.loadItemStackFromNBT(tagList)); + } + } + } - @Override - public void writeToNBT(NBTTagCompound tags) { - super.writeToNBT(tags); - if (invName != null) - tags.setString("InvName", invName); - NBTTagList nbttaglist = new NBTTagList(); - for (int iter = 0; iter < inventory.size(); iter++) { - if (inventory.get(iter) != null) { - NBTTagCompound tagList = new NBTTagCompound(); - tagList.setByte("Slot", (byte) iter); - inventory.get(iter).writeToNBT(tagList); - nbttaglist.appendTag(tagList); - } - } + @Override + public void writeToNBT (NBTTagCompound tags) + { + super.writeToNBT(tags); + if (invName != null) + tags.setString("InvName", invName); + NBTTagList nbttaglist = new NBTTagList(); + for (int iter = 0; iter < inventory.size(); iter++) + { + if (inventory.get(iter) != null) + { + NBTTagCompound tagList = new NBTTagCompound(); + tagList.setByte("Slot", (byte) iter); + inventory.get(iter).writeToNBT(tagList); + nbttaglist.appendTag(tagList); + } + } - tags.setTag("Items", nbttaglist); - } + tags.setTag("Items", nbttaglist); + } - /* Default implementations of hardly used methods */ - public ItemStack getStackInSlotOnClosing(int slot) { - return null; - } + /* Default implementations of hardly used methods */ + public ItemStack getStackInSlotOnClosing (int slot) + { + return null; + } - public void openChest() { - } + public void openChest () + { + } - public void closeChest() { - } + public void closeChest () + { + } - protected abstract String getDefaultName(); + protected abstract String getDefaultName (); - public void setInvName(String name) { - this.invName = name; - } + public void setInvName (String name) + { + this.invName = name; + } - public String getInvName() { - return this.isInvNameLocalized() ? this.invName : getDefaultName(); - } + public String getInvName () + { + return this.isInvNameLocalized() ? this.invName : getDefaultName(); + } - public boolean isInvNameLocalized() { - return this.invName != null && this.invName.length() > 0; - } + public boolean isInvNameLocalized () + { + return this.invName != null && this.invName.length() > 0; + } - public void cleanInventory(){ - Iterator i1 = inventory.iterator(); - while(i1.hasNext()){ - if(i1.next() == null){ - i1.remove(); - } - } - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack itemstack) { - if (slot < getSizeInventory()) { - if (inventory.get(slot) == null || itemstack.stackSize + inventory.get(slot).stackSize <= getInventoryStackLimit()) - return true; - }else{ - return slot < getMaxSize(); - } - return false; - } + public void cleanInventory () + { + Iterator i1 = inventory.iterator(); + while (i1.hasNext()) + { + if (i1.next() == null) + { + i1.remove(); + } + } + } + + @Override + public boolean isItemValidForSlot (int slot, ItemStack itemstack) + { + if (slot < getSizeInventory()) + { + if (inventory.get(slot) == null || itemstack.stackSize + inventory.get(slot).stackSize <= getInventoryStackLimit()) + return true; + } + else + { + return slot < getMaxSize(); + } + return false; + } } diff --git a/src/tconstruct/library/blocks/IDrawbridgeLogicBase.java b/src/tconstruct/library/blocks/IDrawbridgeLogicBase.java index c241042c..b5f67ab1 100644 --- a/src/tconstruct/library/blocks/IDrawbridgeLogicBase.java +++ b/src/tconstruct/library/blocks/IDrawbridgeLogicBase.java @@ -1,7 +1,8 @@ package tconstruct.library.blocks; -public interface IDrawbridgeLogicBase{ +public interface IDrawbridgeLogicBase +{ + + public boolean hasExtended (); - public boolean hasExtended(); - } diff --git a/src/tconstruct/library/blocks/InventoryLogic.java b/src/tconstruct/library/blocks/InventoryLogic.java index e7c9aecd..d0ef03f1 100644 --- a/src/tconstruct/library/blocks/InventoryLogic.java +++ b/src/tconstruct/library/blocks/InventoryLogic.java @@ -111,7 +111,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory super.readFromNBT(tags); readInventoryFromNBT(tags); } - + public void readInventoryFromNBT (NBTTagCompound tags) { super.readFromNBT(tags); @@ -135,7 +135,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory super.writeToNBT(tags); writeInventoryToNBT(tags); } - + public void writeInventoryToNBT (NBTTagCompound tags) { if (invName != null) @@ -154,7 +154,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory tags.setTag("Items", nbttaglist); } - + /* Cause of the heisenbug. Do not uncomment! */ /*public void superReadFromNBT (NBTTagCompound tags) { @@ -165,7 +165,7 @@ public abstract class InventoryLogic extends TileEntity implements IInventory { super.writeToNBT(tags); }*/ - + /* Default implementations of hardly used methods */ public ItemStack getStackInSlotOnClosing (int slot) { @@ -207,14 +207,14 @@ public abstract class InventoryLogic extends TileEntity implements IInventory } return false; } - + public void placeBlock (EntityLivingBase entity, ItemStack stack) { - + } - - public void removeBlock() + + public void removeBlock () { - + } } diff --git a/src/tconstruct/library/client/FluidRenderProperties.java b/src/tconstruct/library/client/FluidRenderProperties.java index b31f3644..58df82e0 100644 --- a/src/tconstruct/library/client/FluidRenderProperties.java +++ b/src/tconstruct/library/client/FluidRenderProperties.java @@ -1,54 +1,63 @@ package tconstruct.library.client; -public class FluidRenderProperties { +public class FluidRenderProperties +{ - //Constant defaults - public static final FluidRenderProperties DEFAULT_TABLE = new FluidRenderProperties(Applications.TABLE); - public static final FluidRenderProperties DEFAULT_BASIN = new FluidRenderProperties(Applications.BASIN); + //Constant defaults + public static final FluidRenderProperties DEFAULT_TABLE = new FluidRenderProperties(Applications.TABLE); + public static final FluidRenderProperties DEFAULT_BASIN = new FluidRenderProperties(Applications.BASIN); - public float minHeight, maxHeight, minX, maxX, minZ, maxZ; + public float minHeight, maxHeight, minX, maxX, minZ, maxZ; - public FluidRenderProperties(float minHeight, float maxHeight, float minX, float maxX, float minZ, float maxZ) { - this.minHeight = minHeight; - this.maxHeight = maxHeight; - this.minX = minX; - this.maxX = maxX; - this.minZ = minZ; - this.maxZ = maxZ; - } + public FluidRenderProperties(float minHeight, float maxHeight, float minX, float maxX, float minZ, float maxZ) + { + this.minHeight = minHeight; + this.maxHeight = maxHeight; + this.minX = minX; + this.maxX = maxX; + this.minZ = minZ; + this.maxZ = maxZ; + } - public FluidRenderProperties(float minHeight, float maxHeight, Applications defaults) { - this(minHeight, maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ); - } + public FluidRenderProperties(float minHeight, float maxHeight, Applications defaults) + { + this(minHeight, maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ); + } - public FluidRenderProperties(float minHeight, float maxHeight, float minX, float maxX, Applications defaults) { - this(minHeight, maxHeight, minX, maxX, defaults.minZ, defaults.maxZ); - } + public FluidRenderProperties(float minHeight, float maxHeight, float minX, float maxX, Applications defaults) + { + this(minHeight, maxHeight, minX, maxX, defaults.minZ, defaults.maxZ); + } - public FluidRenderProperties(Applications defaults, float minX, float maxX) { - this(defaults.minHeight, defaults.maxHeight, minX, maxX, defaults.minZ, defaults.maxZ); - } + public FluidRenderProperties(Applications defaults, float minX, float maxX) + { + this(defaults.minHeight, defaults.maxHeight, minX, maxX, defaults.minZ, defaults.maxZ); + } - public FluidRenderProperties(Applications defaults, float minX, float maxX, float minZ, float maxZ) { - this(defaults.minHeight, defaults.maxHeight, minX, maxX, minZ, maxZ); - } + public FluidRenderProperties(Applications defaults, float minX, float maxX, float minZ, float maxZ) + { + this(defaults.minHeight, defaults.maxHeight, minX, maxX, minZ, maxZ); + } - public FluidRenderProperties(Applications defaults) { - this(defaults.minHeight, defaults.maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ); - } + public FluidRenderProperties(Applications defaults) + { + this(defaults.minHeight, defaults.maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ); + } - public static enum Applications { - TABLE(0.9375F, 1F, 0.0625F, 0.9375F, 0.0625F, 0.9375F), BASIN(0.25F, 0.95F, 0.0625F, 0.9375F, 0.0625F, 0.9375F); + public static enum Applications + { + TABLE(0.9375F, 1F, 0.0625F, 0.9375F, 0.0625F, 0.9375F), BASIN(0.25F, 0.95F, 0.0625F, 0.9375F, 0.0625F, 0.9375F); - public float minHeight, maxHeight, minX, maxX, minZ, maxZ; + public float minHeight, maxHeight, minX, maxX, minZ, maxZ; - Applications(float minHeight, float maxHeight, float minX, float maxX, float minZ, float maxZ) { - this.minHeight = minHeight; - this.maxHeight = maxHeight; - this.minX = minX; - this.maxX = maxX; - this.minZ = minZ; - this.maxZ = maxZ; - } - } + Applications(float minHeight, float maxHeight, float minX, float maxX, float minZ, float maxZ) + { + this.minHeight = minHeight; + this.maxHeight = maxHeight; + this.minX = minX; + this.maxX = maxX; + this.minZ = minZ; + this.maxZ = maxZ; + } + } } \ No newline at end of file diff --git a/src/tconstruct/library/component/IComponentHolder.java b/src/tconstruct/library/component/IComponentHolder.java index 7a352af4..e1869d4f 100644 --- a/src/tconstruct/library/component/IComponentHolder.java +++ b/src/tconstruct/library/component/IComponentHolder.java @@ -4,5 +4,5 @@ import java.util.List; public interface IComponentHolder { - public List getComponents(); + public List getComponents (); } diff --git a/src/tconstruct/library/component/LogicComponent.java b/src/tconstruct/library/component/LogicComponent.java index 9c8a3922..cb3cf35a 100644 --- a/src/tconstruct/library/component/LogicComponent.java +++ b/src/tconstruct/library/component/LogicComponent.java @@ -6,12 +6,12 @@ import net.minecraft.world.World; public class LogicComponent { protected World world; - - public void setWorld(World world) + + public void setWorld (World world) { this.world = world; } - + public void readFromNBT (NBTTagCompound tags) { readNetworkNBT(tags); @@ -19,16 +19,16 @@ public class LogicComponent public void readNetworkNBT (NBTTagCompound tags) { - + } - + public void writeToNBT (NBTTagCompound tags) { writeNetworkNBT(tags); } - + public void writeNetworkNBT (NBTTagCompound tags) { - + } } \ No newline at end of file diff --git a/src/tconstruct/library/component/TankLayerScan.java b/src/tconstruct/library/component/TankLayerScan.java index 0963aae2..c280c17f 100644 --- a/src/tconstruct/library/component/TankLayerScan.java +++ b/src/tconstruct/library/component/TankLayerScan.java @@ -420,7 +420,7 @@ public class TankLayerScan extends LogicComponent } if (!canPass) { - System.out.println("Coord: "+coord); + System.out.println("Coord: " + coord); height = coord.y; break; } diff --git a/src/tconstruct/library/multiblock/MultiblockBaseLogic.java b/src/tconstruct/library/multiblock/MultiblockBaseLogic.java index fedeb831..f372749e 100644 --- a/src/tconstruct/library/multiblock/MultiblockBaseLogic.java +++ b/src/tconstruct/library/multiblock/MultiblockBaseLogic.java @@ -49,7 +49,7 @@ public abstract class MultiblockBaseLogic extends TileEntity implements IMultibl { return (master != null); } - + @Override public boolean willConnect (CoordTuple coord) { @@ -165,7 +165,7 @@ public abstract class MultiblockBaseLogic extends TileEntity implements IMultibl { return; } - + IMultiblockMember[] neighbors = getNeighboringMembers(); List masters = new LinkedList(); @@ -391,11 +391,11 @@ public abstract class MultiblockBaseLogic extends TileEntity implements IMultibl this.master = null; } } - + protected void destroySelf () { pendingDestroy = true; -// this.detachSelf(false); + // this.detachSelf(false); this.getMultiblockMaster().scheduleRemoveAndRevisit(this); } diff --git a/src/tconstruct/library/multiblock/MultiblockMasterBaseLogic.java b/src/tconstruct/library/multiblock/MultiblockMasterBaseLogic.java index 5fc1efb4..789df9f9 100644 --- a/src/tconstruct/library/multiblock/MultiblockMasterBaseLogic.java +++ b/src/tconstruct/library/multiblock/MultiblockMasterBaseLogic.java @@ -247,7 +247,7 @@ public abstract class MultiblockMasterBaseLogic if (forceRevisit) { CoordTuple deadCoords; - + forceRevisit = false; while (!pendingRemovalBlocks.isEmpty()) { @@ -258,7 +258,7 @@ public abstract class MultiblockMasterBaseLogic { referenceCoord = null; } - connectedBlocks.remove(deadCoords); + connectedBlocks.remove(deadCoords); } } if (referenceCoord == null) @@ -290,12 +290,12 @@ public abstract class MultiblockMasterBaseLogic ((IMultiblockMember) te).becomeMultiblockSaveDelegate(); } } - + this.revisitBlocks(); - + forceRecheck = true; } - + if (this.connectedBlocks.isEmpty()) { MultiblockRegistry.unregister(this); diff --git a/src/tconstruct/library/signal/ISignalTransceiver.java b/src/tconstruct/library/signal/ISignalTransceiver.java index 5cded653..56753d14 100644 --- a/src/tconstruct/library/signal/ISignalTransceiver.java +++ b/src/tconstruct/library/signal/ISignalTransceiver.java @@ -9,7 +9,7 @@ public interface ISignalTransceiver void setBusCoords (World world, int xCoord, int yCoord, int zCoord); CoordTuple getBusCoords (); - + byte[] getReceivedSignals (); void receiveSignalUpdate (byte[] signals); @@ -17,5 +17,5 @@ public interface ISignalTransceiver int doUnregister (boolean reHoming); int getDroppedWire (); - + } diff --git a/src/tconstruct/library/tools/HarvestTool.java b/src/tconstruct/library/tools/HarvestTool.java index 1572dea9..f0db4885 100644 --- a/src/tconstruct/library/tools/HarvestTool.java +++ b/src/tconstruct/library/tools/HarvestTool.java @@ -79,8 +79,8 @@ public abstract class HarvestTool extends ToolCore } return super.getStrVsBlock(stack, block, meta); } - - float calculateStrength(NBTTagCompound tags, Block block, int meta) + + float calculateStrength (NBTTagCompound tags, Block block, int meta) { float mineSpeed = tags.getInteger("MiningSpeed"); int heads = 1; diff --git a/src/tconstruct/library/tools/ToolCore.java b/src/tconstruct/library/tools/ToolCore.java index 454009d1..e0e90a40 100644 --- a/src/tconstruct/library/tools/ToolCore.java +++ b/src/tconstruct/library/tools/ToolCore.java @@ -66,11 +66,11 @@ import cpw.mods.fml.relauncher.SideOnly; public abstract class ToolCore extends Item implements IEnergyContainerItem, ICustomElectricItem, IBoxable, IBattlegearWeapon, IStorageCell, IAEChargeableItem { - //TE power constants -- TODO grab these from the + //TE power constants -- TODO grab these from the protected int capacity = 80000; protected int maxReceive = 75; protected int maxExtract = 75; - + protected Random random = new Random(); protected int damageVsEntity; public static Icon blankSprite; diff --git a/src/tconstruct/library/tools/Weapon.java b/src/tconstruct/library/tools/Weapon.java index 0f8f5e59..79e88cf1 100644 --- a/src/tconstruct/library/tools/Weapon.java +++ b/src/tconstruct/library/tools/Weapon.java @@ -125,6 +125,5 @@ public abstract class Weapon extends ToolCore public static Material[] web = new Material[] { Material.web }; public static Material[] none = new Material[0]; - - + } diff --git a/src/tconstruct/library/util/CoordTuple.java b/src/tconstruct/library/util/CoordTuple.java index 40750ae2..f95f2985 100644 --- a/src/tconstruct/library/util/CoordTuple.java +++ b/src/tconstruct/library/util/CoordTuple.java @@ -12,7 +12,7 @@ public class CoordTuple implements Comparable y = posY; z = posZ; } - + public CoordTuple(double posX, double posY, double posZ) { x = (int) Math.floor(posX); diff --git a/src/tconstruct/library/util/CoordTuplePair.java b/src/tconstruct/library/util/CoordTuplePair.java index b6343279..f31a2282 100644 --- a/src/tconstruct/library/util/CoordTuplePair.java +++ b/src/tconstruct/library/util/CoordTuplePair.java @@ -4,14 +4,14 @@ public class CoordTuplePair { public CoordTuple a; public CoordTuple b; - - public CoordTuplePair (CoordTuple a, CoordTuple b) + + public CoordTuplePair(CoordTuple a, CoordTuple b) { this.a = a; this.b = b; } - - public CoordTuplePair (int aX, int aY, int aZ, int bX, int bY, int bZ) + + public CoordTuplePair(int aX, int aY, int aZ, int bX, int bY, int bZ) { this.a = new CoordTuple(aX, aY, aZ); this.b = new CoordTuple(bX, bY, bZ); diff --git a/src/tconstruct/library/util/CoordTupleSort.java b/src/tconstruct/library/util/CoordTupleSort.java index 93aed234..52846592 100644 --- a/src/tconstruct/library/util/CoordTupleSort.java +++ b/src/tconstruct/library/util/CoordTupleSort.java @@ -6,20 +6,20 @@ public class CoordTupleSort implements Comparator { @Override public int compare (Object o1, Object o2) - { + { CoordTuple c1 = (CoordTuple) o1; CoordTuple c2 = (CoordTuple) o2; - + //Sort by y, then x, then z if (c1.y != c2.y) return c1.y - c2.y; - + if (c1.x != c2.x) return c1.x - c2.x; - + if (c1.z != c2.z) return c1.z - c2.z; - + return 0; } } diff --git a/src/tconstruct/library/util/IMasterNode.java b/src/tconstruct/library/util/IMasterNode.java index edf609ba..3b72c1aa 100644 --- a/src/tconstruct/library/util/IMasterNode.java +++ b/src/tconstruct/library/util/IMasterNode.java @@ -2,7 +2,7 @@ package tconstruct.library.util; public interface IMasterNode extends IMasterLogic, IServantLogic { - public boolean isCurrentlyMaster(); - - public boolean isEquivalentMaster(IMasterLogic master); + public boolean isCurrentlyMaster (); + + public boolean isEquivalentMaster (IMasterLogic master); } diff --git a/src/tconstruct/library/util/IServantLogic.java b/src/tconstruct/library/util/IServantLogic.java index 9bd6d0a0..79bb59ce 100644 --- a/src/tconstruct/library/util/IServantLogic.java +++ b/src/tconstruct/library/util/IServantLogic.java @@ -8,7 +8,7 @@ public interface IServantLogic /** The block should already have a valid master */ public void notifyMasterOfChange (); - + /** Checks if this block can be tied to this master * * @param master @@ -17,9 +17,9 @@ public interface IServantLogic * @param z zCoord of master * @return whether the servant can be tied to this master */ - - public boolean setPotentialMaster(IMasterLogic master, World world, int xMaster, int yMaster, int zMaster); - + + public boolean setPotentialMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster); + /** Used to set and verify that this is the block's master * * @param master @@ -30,7 +30,7 @@ public interface IServantLogic */ public boolean verifyMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster); - + /** Exactly what it says on the tin * * @param master @@ -38,6 +38,6 @@ public interface IServantLogic * @param y yCoord of master * @param z zCoord of master */ - - public void invalidateMaster(IMasterLogic master, World world, int xMaster, int yMaster, int zMaster); + + public void invalidateMaster (IMasterLogic master, World world, int xMaster, int yMaster, int zMaster); } diff --git a/src/tconstruct/plugins/fmp/register/ConnectedTexturesMicroMaterial.java b/src/tconstruct/plugins/fmp/register/ConnectedTexturesMicroMaterial.java index 0b7c62c4..1a0472dc 100644 --- a/src/tconstruct/plugins/fmp/register/ConnectedTexturesMicroMaterial.java +++ b/src/tconstruct/plugins/fmp/register/ConnectedTexturesMicroMaterial.java @@ -11,29 +11,34 @@ import net.minecraft.world.IBlockAccess; import tconstruct.blocks.GlassBlockConnected; import tconstruct.util.config.PHConstruct; -public class ConnectedTexturesMicroMaterial extends BlockMicroMaterial { +public class ConnectedTexturesMicroMaterial extends BlockMicroMaterial +{ - public GlassBlockConnected b; + public GlassBlockConnected b; - MultiIconTransformation icont = null; + MultiIconTransformation icont = null; - public ConnectedTexturesMicroMaterial(GlassBlockConnected block, int meta) { - super(block, meta); - b = block; - } - - @Override - public void loadIcons() { - icont = new MultiIconTransformation(b.getIcons()); - } + public ConnectedTexturesMicroMaterial(GlassBlockConnected block, int meta) + { + super(block, meta); + b = block; + } - @Override - public void renderMicroFace(Vertex5[] verts, int side, Vector3 pos, LightMatrix lightMatrix, IMicroMaterialRender part) { - renderMicroFace(verts, side, pos, lightMatrix, getColour(part), icont); - } - - public int determineTextre(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5){ - if (PHConstruct.connectedTexturesMode == 0) + @Override + public void loadIcons () + { + icont = new MultiIconTransformation(b.getIcons()); + } + + @Override + public void renderMicroFace (Vertex5[] verts, int side, Vector3 pos, LightMatrix lightMatrix, IMicroMaterialRender part) + { + renderMicroFace(verts, side, pos, lightMatrix, getColour(part), icont); + } + + public int determineTextre (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) + { + if (PHConstruct.connectedTexturesMode == 0) { return 0; } @@ -537,37 +542,43 @@ public class ConnectedTexturesMicroMaterial extends BlockMicroMaterial { } return 0; - } + } - public void renderMicroFace(Vertex5[] verts, int side, Vector3 pos, LightMatrix lightMatrix, int colour, IUVTransformation uvt) { - UV uv = new UV(); - Tessellator t = Tessellator.instance; - int i = 0; - while (i < 4) { - if (CCRenderState.useNormals()) { - Vector3 n = Rotation.axes[side % 6]; - t.setNormal((float) n.x, (float) n.y, (float) n.z); - } - Vertex5 vert = verts[i]; - if (lightMatrix != null) { - LC lc = LC.computeO(vert.vec, side); - if (CCRenderState.useModelColours()) - lightMatrix.setColour(t, lc, colour); - lightMatrix.setBrightness(t, lc); - } else { - if (CCRenderState.useModelColours()) - CCRenderState.vertexColour(colour); - } - -// ((MultiIconTransformation)uvt).setIconIndex(null, determineTextre(Minecraft.getMinecraft().theWorld, (int)pos.x, (int)pos.y, (int)pos.z, side)); - - uvt.transform(uv.set(vert.uv)); - t.addVertexWithUV(vert.vec.x + pos.x, vert.vec.y + pos.y, vert.vec.z + pos.z, uv.u, uv.v); - i += 1; - } - } - - public static void createAndRegister(GlassBlockConnected block) + public void renderMicroFace (Vertex5[] verts, int side, Vector3 pos, LightMatrix lightMatrix, int colour, IUVTransformation uvt) + { + UV uv = new UV(); + Tessellator t = Tessellator.instance; + int i = 0; + while (i < 4) + { + if (CCRenderState.useNormals()) + { + Vector3 n = Rotation.axes[side % 6]; + t.setNormal((float) n.x, (float) n.y, (float) n.z); + } + Vertex5 vert = verts[i]; + if (lightMatrix != null) + { + LC lc = LC.computeO(vert.vec, side); + if (CCRenderState.useModelColours()) + lightMatrix.setColour(t, lc, colour); + lightMatrix.setBrightness(t, lc); + } + else + { + if (CCRenderState.useModelColours()) + CCRenderState.vertexColour(colour); + } + + // ((MultiIconTransformation)uvt).setIconIndex(null, determineTextre(Minecraft.getMinecraft().theWorld, (int)pos.x, (int)pos.y, (int)pos.z, side)); + + uvt.transform(uv.set(vert.uv)); + t.addVertexWithUV(vert.vec.x + pos.x, vert.vec.y + pos.y, vert.vec.z + pos.z, uv.u, uv.v); + i += 1; + } + } + + public static void createAndRegister (GlassBlockConnected block) { MicroMaterialRegistry.registerMaterial(new ConnectedTexturesMicroMaterial(block, 0), block.getUnlocalizedName()); } diff --git a/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java b/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java index 5d81ebe6..3a614e6c 100644 --- a/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java +++ b/src/tconstruct/plugins/fmp/register/RegisterWithFMP.java @@ -17,12 +17,13 @@ public class RegisterWithFMP MicroMaterialRegistry.registerMaterial(new BlockMicroMaterial(block, meta), identifier + meta); } } + //For blocks without metadata values only. public static void registerBlock (Block block) { BlockMicroMaterial.createAndRegister(block); } - + //For blocks with metadata values and special MicroMaterial only public static void registerBlock (Block block, int metastart, int metaend, IMicroMaterial material) { @@ -32,6 +33,7 @@ public class RegisterWithFMP MicroMaterialRegistry.registerMaterial(material, identifier + meta); } } + //For blocks without metadata values and special MicroMaterial only. public static void registerBlock (Block block, IMicroMaterial material) { diff --git a/src/tconstruct/plugins/minefactoryreloaded/mfrRegistering.java b/src/tconstruct/plugins/minefactoryreloaded/mfrRegistering.java index a727fcf3..c0ca1473 100644 --- a/src/tconstruct/plugins/minefactoryreloaded/mfrRegistering.java +++ b/src/tconstruct/plugins/minefactoryreloaded/mfrRegistering.java @@ -10,6 +10,6 @@ public class mfrRegistering { FactoryRegistry.registerHarvestable(new HarvestableOreBerry(TContent.oreBerry.blockID, TContent.oreBerries.itemID, 0)); FactoryRegistry.registerHarvestable(new HarvestableOreBerry(TContent.oreBerrySecond.blockID, TContent.oreBerries.itemID, 4)); - + } } diff --git a/src/tconstruct/plugins/nei/NEICompat.java b/src/tconstruct/plugins/nei/NEICompat.java index 93d9785c..8e72da88 100644 --- a/src/tconstruct/plugins/nei/NEICompat.java +++ b/src/tconstruct/plugins/nei/NEICompat.java @@ -9,13 +9,16 @@ import codechicken.nei.recipe.DefaultOverlayHandler; import codechicken.nei.api.API; import tconstruct.client.gui.CraftingStationGui; -public class NEICompat { +public class NEICompat +{ + + public static void registerNEICompat () + { + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) + { + API.registerGuiOverlay(CraftingStationGui.class, "crafting"); + API.registerGuiOverlayHandler(CraftingStationGui.class, new DefaultOverlayHandler(), "crafting"); + } + } - public static void registerNEICompat(){ - if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT){ - API.registerGuiOverlay(CraftingStationGui.class, "crafting"); - API.registerGuiOverlayHandler(CraftingStationGui.class, new DefaultOverlayHandler(), "crafting"); - } - } - } diff --git a/src/tconstruct/plugins/waila/CastingChannelDataProvider.java b/src/tconstruct/plugins/waila/CastingChannelDataProvider.java index a09f743b..647cad9f 100644 --- a/src/tconstruct/plugins/waila/CastingChannelDataProvider.java +++ b/src/tconstruct/plugins/waila/CastingChannelDataProvider.java @@ -9,27 +9,35 @@ import tconstruct.blocks.logic.CastingChannelLogic; import java.util.List; -public class CastingChannelDataProvider implements IWailaDataProvider { +public class CastingChannelDataProvider implements IWailaDataProvider +{ @Override - public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { + public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config) + { return null; } @Override - public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaHead (ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) + { return currenttip; } @Override - public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (accessor.getTileEntity() instanceof CastingChannelLogic) { - CastingChannelLogic te = (CastingChannelLogic)accessor.getTileEntity(); - if (te.liquid != null && te.liquid.amount > 0) { + public List getWailaBody (ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) + { + if (accessor.getTileEntity() instanceof CastingChannelLogic) + { + CastingChannelLogic te = (CastingChannelLogic) accessor.getTileEntity(); + if (te.liquid != null && te.liquid.amount > 0) + { FluidStack fs = te.liquid; currenttip.add("Liquid: " + WailaRegistrar.fluidNameHelper(fs)); currenttip.add("Amount: " + fs.amount + "/" + te.getCapacity()); - } else { + } + else + { currenttip.add("§oEmpty"); // "§o" == Italics } } diff --git a/src/tconstruct/plugins/waila/EssenceExtractorDataProvider.java b/src/tconstruct/plugins/waila/EssenceExtractorDataProvider.java index 6746ee0b..e40c98ed 100644 --- a/src/tconstruct/plugins/waila/EssenceExtractorDataProvider.java +++ b/src/tconstruct/plugins/waila/EssenceExtractorDataProvider.java @@ -8,22 +8,27 @@ import tconstruct.blocks.logic.EssenceExtractorLogic; import java.util.List; -public class EssenceExtractorDataProvider implements IWailaDataProvider { +public class EssenceExtractorDataProvider implements IWailaDataProvider +{ @Override - public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { + public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config) + { return null; } @Override - public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaHead (ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) + { return currenttip; } @Override - public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (accessor.getTileEntity() instanceof EssenceExtractorLogic) { - EssenceExtractorLogic te = (EssenceExtractorLogic)accessor.getTileEntity(); + public List getWailaBody (ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) + { + if (accessor.getTileEntity() instanceof EssenceExtractorLogic) + { + EssenceExtractorLogic te = (EssenceExtractorLogic) accessor.getTileEntity(); currenttip.add("Total Essence: " + te.essenceAmount); currenttip.add("Stored Levels: " + EssenceExtractorLogic.getEssencelevels(te.essenceAmount)); } diff --git a/src/tconstruct/plugins/waila/SearedTankDataProvider.java b/src/tconstruct/plugins/waila/SearedTankDataProvider.java index 9bf7972b..1414643f 100644 --- a/src/tconstruct/plugins/waila/SearedTankDataProvider.java +++ b/src/tconstruct/plugins/waila/SearedTankDataProvider.java @@ -9,27 +9,35 @@ import tconstruct.blocks.logic.LavaTankLogic; import java.util.List; -public class SearedTankDataProvider implements IWailaDataProvider { +public class SearedTankDataProvider implements IWailaDataProvider +{ @Override - public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { + public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config) + { return null; } @Override - public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaHead (ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) + { return currenttip; } @Override - public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (accessor.getTileEntity() instanceof LavaTankLogic) { - LavaTankLogic te = (LavaTankLogic)accessor.getTileEntity(); - if (te.containsFluid()) { + public List getWailaBody (ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) + { + if (accessor.getTileEntity() instanceof LavaTankLogic) + { + LavaTankLogic te = (LavaTankLogic) accessor.getTileEntity(); + if (te.containsFluid()) + { FluidStack fs = te.tank.getFluid(); currenttip.add("Liquid: " + WailaRegistrar.fluidNameHelper(fs)); currenttip.add("Amount: " + fs.amount + "/" + te.tank.getCapacity()); - } else { + } + else + { currenttip.add("§oEmpty"); // "§o" == Italics } } diff --git a/src/tconstruct/plugins/waila/SmelteryDataProvider.java b/src/tconstruct/plugins/waila/SmelteryDataProvider.java index 30cbf378..9b49cd04 100644 --- a/src/tconstruct/plugins/waila/SmelteryDataProvider.java +++ b/src/tconstruct/plugins/waila/SmelteryDataProvider.java @@ -9,33 +9,45 @@ import tconstruct.blocks.logic.SmelteryLogic; import java.util.List; -public class SmelteryDataProvider implements IWailaDataProvider { +public class SmelteryDataProvider implements IWailaDataProvider +{ @Override - public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { + public ItemStack getWailaStack (IWailaDataAccessor accessor, IWailaConfigHandler config) + { return null; } @Override - public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaHead (ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) + { return currenttip; } @Override - public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - if (accessor.getTileEntity() instanceof SmelteryLogic) { - SmelteryLogic te = (SmelteryLogic)accessor.getTileEntity(); - if (te.validStructure) { + public List getWailaBody (ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) + { + if (accessor.getTileEntity() instanceof SmelteryLogic) + { + SmelteryLogic te = (SmelteryLogic) accessor.getTileEntity(); + if (te.validStructure) + { List fls = te.moltenMetal; - if (fls.size() <= 0) { + if (fls.size() <= 0) + { currenttip.add("§oEmpty"); // "§o" == Italics - } else { - for (int i = 0; i < fls.size(); i++) { + } + else + { + for (int i = 0; i < fls.size(); i++) + { FluidStack st = fls.get(i); currenttip.add(WailaRegistrar.fluidNameHelper(st) + " (" + st.amount + "mB)"); } } - } else { + } + else + { currenttip.add("§oInvalid structure"); } } diff --git a/src/tconstruct/plugins/waila/Waila.java b/src/tconstruct/plugins/waila/Waila.java index 701fc07a..2bb8fd53 100644 --- a/src/tconstruct/plugins/waila/Waila.java +++ b/src/tconstruct/plugins/waila/Waila.java @@ -8,12 +8,12 @@ import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.network.NetworkMod; - import java.util.logging.Logger; @Mod(modid = "TConstruct|CompatWaila", name = "TConstruct Compat: Waila", version = "0.0.1", dependencies = "after:Waila;required-after:TConstruct") @NetworkMod(clientSideRequired = false, serverSideRequired = false) -public class Waila { +public class Waila +{ public static Logger logger = Logger.getLogger("TConstruct Waila"); @@ -22,17 +22,21 @@ public class Waila { { logger.setParent(FMLCommonHandler.instance().getFMLLogger()); - if (!Loader.isModLoaded("Waila")) { + if (!Loader.isModLoaded("Waila")) + { logger.warning("Waila missing - TConstruct Compat: Waila not loading."); return; - } try { + } + try + { logger.info("Waila detected. Registering TConstruct tank blocks with Waila registry."); - - FMLInterModComms.sendMessage("Waila", "register", "tconstruct.plugins.waila.WailaRegistrar.wailaCallback"); - } catch (Exception e) { + + FMLInterModComms.sendMessage("Waila", "register", "tconstruct.plugins.waila.WailaRegistrar.wailaCallback"); + } + catch (Exception e) + { e.printStackTrace(); } } - } diff --git a/src/tconstruct/plugins/waila/WailaRegistrar.java b/src/tconstruct/plugins/waila/WailaRegistrar.java index a69bf9ec..6e21ca21 100644 --- a/src/tconstruct/plugins/waila/WailaRegistrar.java +++ b/src/tconstruct/plugins/waila/WailaRegistrar.java @@ -10,7 +10,8 @@ import tconstruct.blocks.logic.CastingChannelLogic; public class WailaRegistrar { - public static void wailaCallback(IWailaRegistrar registrar) { + public static void wailaCallback (IWailaRegistrar registrar) + { Waila.logger.info("Got registrar: " + registrar); // Tanks @@ -22,7 +23,8 @@ public class WailaRegistrar registrar.registerBodyProvider(new SmelteryDataProvider(), SmelteryBlock.class); } - public static String fluidNameHelper(FluidStack f) { + public static String fluidNameHelper (FluidStack f) + { return StatCollector.translateToLocal(FluidRegistry.getFluidName(f)); } diff --git a/src/tconstruct/preloader/ASMInterfaceRepair.java b/src/tconstruct/preloader/ASMInterfaceRepair.java index df6b36a3..d2f92552 100644 --- a/src/tconstruct/preloader/ASMInterfaceRepair.java +++ b/src/tconstruct/preloader/ASMInterfaceRepair.java @@ -18,14 +18,15 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -public class ASMInterfaceRepair implements IClassTransformer { +public class ASMInterfaceRepair implements IClassTransformer +{ - public static Map APIInterfaces = new HashMap(); + public static Map APIInterfaces = new HashMap(); @Override - public byte[] transform(String name, String transformedName, byte[] bytes) + public byte[] transform (String name, String transformedName, byte[] bytes) { - if ( name.startsWith( "tconstruct." ) && !isBlacklisted(name) ) + if (name.startsWith("tconstruct.") && !isBlacklisted(name)) { ClassReader cr = new ClassReader(bytes); ClassNode cn = new ClassNode(); @@ -33,104 +34,107 @@ public class ASMInterfaceRepair implements IClassTransformer { boolean changed = false; - if ( this.verifyAPI(cn) ) + if (this.verifyAPI(cn)) changed = true; - if ( changed ) + if (changed) { ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); cn.accept(cw); bytes = cw.toByteArray(); - log( "Altering definition of " + transformedName ); + log("Altering definition of " + transformedName); } } return bytes; } - private boolean isInternal( String path ) + private boolean isInternal (String path) { - return path.startsWith( "java/" ) - || path.startsWith( "cpw/mods/fml/" ) - || path.startsWith( "tconstruct/" ) - || path.startsWith( "com/google/" ) - || path.startsWith( "net/minecraftforge/" ) - || path.startsWith( "net/minecraft/" ); + return path.startsWith("java/") || path.startsWith("cpw/mods/fml/") || path.startsWith("tconstruct/") || path.startsWith("com/google/") || path.startsWith("net/minecraftforge/") + || path.startsWith("net/minecraft/"); } // Used in transform() above. - private boolean isBlacklisted( String path ) + private boolean isBlacklisted (String path) { - return path.startsWith( "tconstruct.plugins." ) - || path.startsWith("tconstruct.preloader."); + return path.startsWith("tconstruct.plugins.") || path.startsWith("tconstruct.preloader."); } - private boolean isClassAvailable( String inf ) + private boolean isClassAvailable (String inf) { - if ( APIInterfaces.containsKey( inf ) ) - return APIInterfaces.get( inf ); + if (APIInterfaces.containsKey(inf)) + return APIInterfaces.get(inf); boolean isAvailable = false; Class obj = null; try { - obj = Class.forName( inf.replace( "/", "." ) ); + obj = Class.forName(inf.replace("/", ".")); //obj = ReflectionHelper.getClass( getClass().getClassLoader(), inf.replace( "/", "." ) ); } - catch ( Throwable _ ) {} + catch (Throwable _) + { + } // java.io.InputStream is = this.getClass().getResourceAsStream( "/" + inf + ".class" ); - APIInterfaces.put( inf, isAvailable = ( obj != null) ); + APIInterfaces.put(inf, isAvailable = (obj != null)); return isAvailable; } - class SigChecker extends SignatureVisitor { + class SigChecker extends SignatureVisitor + { private ASMInterfaceRepair asmTransformer; public boolean isAvailable = true; - public SigChecker(int api, ASMInterfaceRepair t) { + public SigChecker(int api, ASMInterfaceRepair t) + { super(api); asmTransformer = t; } @Override - public void visitInnerClassType(String name) { + public void visitInnerClassType (String name) + { visitTypeVariable(name); } @Override - public void visitClassType(String name) { + public void visitClassType (String name) + { visitTypeVariable(name); } @Override - public void visitTypeVariable(String className) { - if ( isInternal( className ) ) return; - isAvailable = isAvailable && asmTransformer.isClassAvailable( className ); - log( className + " is " + ( isAvailable ? "available" : "not available" ) ); + public void visitTypeVariable (String className) + { + if (isInternal(className)) + return; + isAvailable = isAvailable && asmTransformer.isClassAvailable(className); + log(className + " is " + (isAvailable ? "available" : "not available")); } } - private boolean verifyAPI(ClassNode cn) + private boolean verifyAPI (ClassNode cn) { boolean changed = false; - log( "Examining " + cn.name ); + log("Examining " + cn.name); Iterator mn = cn.methods.iterator(); - while ( mn.hasNext() ) + while (mn.hasNext()) { MethodNode meth = mn.next(); - SigChecker sc = new SigChecker(1,this); - ( new SignatureReader(meth.desc) ).accept( sc ); + SigChecker sc = new SigChecker(1, this); + (new SignatureReader(meth.desc)).accept(sc); boolean isAvailable = sc.isAvailable; - if ( ! isAvailable ) + if (!isAvailable) { mn.remove(); changed = true; @@ -138,17 +142,17 @@ public class ASMInterfaceRepair implements IClassTransformer { } Iterator i = cn.interfaces.iterator(); - while ( i.hasNext() ) + while (i.hasNext()) { String inf = i.next(); - if ( isInternal( inf ) ) + if (isInternal(inf)) continue; - boolean isAvailable = isClassAvailable( inf ); - log( inf + " is " + ( isAvailable ? "available" : "not available" ) ); + boolean isAvailable = isClassAvailable(inf); + log(inf + " is " + (isAvailable ? "available" : "not available")); - if ( ! isAvailable ) + if (!isAvailable) { i.remove(); changed = true; @@ -158,9 +162,11 @@ public class ASMInterfaceRepair implements IClassTransformer { return changed; } - private void log(String string) { - if (PropertyManager.asmInterfaceRepair_verboseLog) { - TConstructLoaderContainer.logger.info( string ); + private void log (String string) + { + if (PropertyManager.asmInterfaceRepair_verboseLog) + { + TConstructLoaderContainer.logger.info(string); } } diff --git a/src/tconstruct/preloader/TConstructLoaderContainer.java b/src/tconstruct/preloader/TConstructLoaderContainer.java index 339635d6..0774f563 100644 --- a/src/tconstruct/preloader/TConstructLoaderContainer.java +++ b/src/tconstruct/preloader/TConstructLoaderContainer.java @@ -22,25 +22,31 @@ import java.util.Arrays; import java.util.Map; import java.util.logging.Logger; -public class TConstructLoaderContainer extends DummyModContainer implements IFMLLoadingPlugin { +public class TConstructLoaderContainer extends DummyModContainer implements IFMLLoadingPlugin +{ - private final String[] asmTransformers = new String[]{"tconstruct.preloader.ASMInterfaceRepair"}; + private final String[] asmTransformers = new String[] { "tconstruct.preloader.ASMInterfaceRepair" }; private final ModMetadata md = new ModMetadata(); public static Logger logger = Logger.getLogger("TCon-Preloader"); - public TConstructLoaderContainer() { + public TConstructLoaderContainer() + { logger.setParent(FMLLog.getLogger()); logger.info("Scalpel. Suction. Lumber axe. CLEAR! *zap*"); logger.info("Constructing preloader (Modules: " + Arrays.toString(asmTransformers) + ")"); - try { + try + { PropertyManager.getOrCreateProps(); - } catch (PropAccessException ex) { + } + catch (PropAccessException ex) + { logger.severe("Could not get or create properties file! Assuming defaults."); logger.severe(Arrays.toString(ex.getStackTrace())); } - if (PropertyManager.asmInterfaceRepair_verboseLog) { + if (PropertyManager.asmInterfaceRepair_verboseLog) + { logger.warning("ASM Interface Repair is set to be verbose, this is NOT GOOD FOR SERVERS, as it will spam the logs!"); logger.warning("The debug mode is for debug use only. Turn it off unless instructed otherwise by a TCon developer!"); logger.warning("To reset advanced settings to default, delete the '" + PropertyManager.propFileName + "' file from the config folder."); @@ -55,71 +61,86 @@ public class TConstructLoaderContainer extends DummyModContainer implements IFML } @ForgeSubscribe - public void preInit(FMLPreInitializationEvent evt) { + public void preInit (FMLPreInitializationEvent evt) + { } @ForgeSubscribe - public void init(FMLInitializationEvent evt) { + public void init (FMLInitializationEvent evt) + { } @ForgeSubscribe - public void postInit(FMLPostInitializationEvent evt) { + public void postInit (FMLPostInitializationEvent evt) + { } @Override - public String getModId() { + public String getModId () + { return "TConstruct-Preloader"; } @Override - public String getName() { + public String getName () + { return "Tinkers Corestruct"; } @Override - public String getVersion() { + public String getVersion () + { return "0.0.1"; } @Override - public String getDisplayVersion() { + public String getDisplayVersion () + { return getVersion(); } @Override - public ModMetadata getMetadata() { + public ModMetadata getMetadata () + { return md; } @Override - public boolean registerBus(EventBus bus, LoadController controller) { + public boolean registerBus (EventBus bus, LoadController controller) + { bus.register(this); return true; } @Override - public String[] getLibraryRequestClass() { + public String[] getLibraryRequestClass () + { return null; } @Override - public String[] getASMTransformerClass() { + public String[] getASMTransformerClass () + { return asmTransformers; } @Override - public String getModContainerClass() { + public String getModContainerClass () + { return "tconstruct.preloader.TConstructLoaderContainer"; } @Override - public String getSetupClass() { + public String getSetupClass () + { return null; } @Override - public void injectData(Map data) {} + public void injectData (Map data) + { + } } diff --git a/src/tconstruct/preloader/helpers/PropertyManager.java b/src/tconstruct/preloader/helpers/PropertyManager.java index 595818ae..6eff73b8 100644 --- a/src/tconstruct/preloader/helpers/PropertyManager.java +++ b/src/tconstruct/preloader/helpers/PropertyManager.java @@ -15,9 +15,12 @@ import java.util.Properties; * * @author Sunstrike */ -public class PropertyManager { +public class PropertyManager +{ - private PropertyManager() {} // Singleton + private PropertyManager() + { + } // Singleton public static final String propFileName = "TConPreloader.cfg"; @@ -29,35 +32,48 @@ public class PropertyManager { * @throws PropAccessException Thrown if a properties file wasn't found and could not be created. Should be treated as a SEVERE log message. * @return True if loaded from disk, false if file created instead. */ - public static boolean getOrCreateProps() throws PropAccessException { + public static boolean getOrCreateProps () throws PropAccessException + { File fp = new File("config/" + propFileName); Properties props = new Properties(); - if (fp.exists()) { + if (fp.exists()) + { // Attempt read - try { + try + { TConstructLoaderContainer.logger.info("Found a properties file. Attempting load..."); props.load(new FileInputStream(fp)); asmInterfaceRepair_verboseLog = props.getProperty("asmInterfaceRepair_verboseLog", "false").equalsIgnoreCase("true"); TConstructLoaderContainer.logger.info("Loaded properties successfully. Using specified settings."); - } catch (IOException ex) { + } + catch (IOException ex) + { throw new PropAccessException(); } - } else { + } + else + { // Attempt creation - try { - if (fp.createNewFile()) { + try + { + if (fp.createNewFile()) + { TConstructLoaderContainer.logger.info("Creating new properties file, as none found..."); props.setProperty("asmInterfaceRepair_verboseLog", "false"); props.store(new FileOutputStream(fp), null); TConstructLoaderContainer.logger.info("Created properties file; using defaults this run."); - } else { + } + else + { throw new PropAccessException(); } - } catch (IOException ex) { + } + catch (IOException ex) + { ex.printStackTrace(); throw new PropAccessException(); } @@ -66,6 +82,8 @@ public class PropertyManager { return false; } - public static class PropAccessException extends Exception {} + public static class PropAccessException extends Exception + { + } } diff --git a/src/tconstruct/util/CallableSuppConfig.java b/src/tconstruct/util/CallableSuppConfig.java index 548094b8..63a484e6 100644 --- a/src/tconstruct/util/CallableSuppConfig.java +++ b/src/tconstruct/util/CallableSuppConfig.java @@ -5,17 +5,22 @@ import cpw.mods.fml.common.ICrashCallable; import java.util.List; // Crash handler for when an unsupported mod is running alongside us -public class CallableSuppConfig implements ICrashCallable { +public class CallableSuppConfig implements ICrashCallable +{ - public CallableSuppConfig() {} + public CallableSuppConfig() + { + } @Override - public String getLabel() { + public String getLabel () + { return "TConstruct Environment"; } @Override - public String call() throws Exception { + public String call () throws Exception + { return "Sane and ready for action. Bugs may be reported."; } diff --git a/src/tconstruct/util/CallableUnsuppConfig.java b/src/tconstruct/util/CallableUnsuppConfig.java index aa8b775e..a1a3f167 100644 --- a/src/tconstruct/util/CallableUnsuppConfig.java +++ b/src/tconstruct/util/CallableUnsuppConfig.java @@ -5,24 +5,29 @@ import cpw.mods.fml.common.ICrashCallable; import java.util.List; // Crash handler for when an unsupported mod is running alongside us -public class CallableUnsuppConfig implements ICrashCallable { +public class CallableUnsuppConfig implements ICrashCallable +{ private List modIds; - public CallableUnsuppConfig(List modIds) { + public CallableUnsuppConfig(List modIds) + { this.modIds = modIds; } @Override - public String getLabel() { + public String getLabel () + { return "TConstruct Environment"; } @Override - public String call() throws Exception { + public String call () throws Exception + { String str = "DO NOT REPORT THIS CRASH! Unsupported mods in environment: "; Boolean firstEntry = true; - for (String id : modIds) { + for (String id : modIds) + { str = str + (firstEntry ? id : ", " + id); firstEntry = false; } diff --git a/src/tconstruct/util/DamageSourceFireworkExplode.java b/src/tconstruct/util/DamageSourceFireworkExplode.java index e465d36f..edaae009 100644 --- a/src/tconstruct/util/DamageSourceFireworkExplode.java +++ b/src/tconstruct/util/DamageSourceFireworkExplode.java @@ -5,7 +5,8 @@ import net.minecraft.util.DamageSource; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ChatMessageComponent; -public class DamageSourceFireworkExplode extends DamageSource{ +public class DamageSourceFireworkExplode extends DamageSource +{ public DamageSourceFireworkExplode(String s) { @@ -17,5 +18,5 @@ public class DamageSourceFireworkExplode extends DamageSource{ { return super.getDeathMessage(par1EntityLivingBase); } - + } diff --git a/src/tconstruct/util/EnvironmentChecks.java b/src/tconstruct/util/EnvironmentChecks.java index 02e76309..0da98f74 100644 --- a/src/tconstruct/util/EnvironmentChecks.java +++ b/src/tconstruct/util/EnvironmentChecks.java @@ -10,18 +10,24 @@ import tconstruct.TConstruct; import java.util.ArrayList; import java.util.List; -public class EnvironmentChecks { +public class EnvironmentChecks +{ - private EnvironmentChecks() {} // Singleton + private EnvironmentChecks() + { + } // Singleton /** * Checks for conflicting stuff in environment; adds callable to any crash logs if so. */ - public static void verifyEnvironmentSanity() { + public static void verifyEnvironmentSanity () + { List modIds = new ArrayList(); - if (Loader.isModLoaded("gregtech_addon")) { - TConstruct.logger.severe("[Environment Checks] Gelatinous iceberg dead ahead! Entering Greggy waters! Abandon hope all ye who enter here! (No, seriously, we don't support GT. Don't report any issues. Thanks.)"); + if (Loader.isModLoaded("gregtech_addon")) + { + TConstruct.logger + .severe("[Environment Checks] Gelatinous iceberg dead ahead! Entering Greggy waters! Abandon hope all ye who enter here! (No, seriously, we don't support GT. Don't report any issues. Thanks.)"); TConstruct.logger.severe("[Environment Checks] A NOTE TO THE USER: Gregtech has been known to crash the game with Metallurgy and for certain specific 'banished' players."); TConstruct.logger.severe("[Environment Checks] For this reason, the TCon dev team urge you to seek your tedium fix from someone else, as Greg disobeys"); TConstruct.logger.severe("[Environment Checks] the basic tenets of good modders conduct. We log this message rather than sabotage. We'd hope he'd do the same."); @@ -29,25 +35,33 @@ public class EnvironmentChecks { modIds.add("gregtech_addon"); } - if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine()) { + if (FMLCommonHandler.instance().getSide() == Side.CLIENT && FMLClientHandler.instance().hasOptifine()) + { TConstruct.logger.severe("[Environment Checks] Optifine detected. This is a Bad Thing(tm) and can crash Minecraft due to an Optifine bug during TCon armor renders!"); modIds.add("optifine"); } - try { + try + { Class cl = Class.forName("org.bukkit.Bukkit"); - if (cl != null) { + if (cl != null) + { TConstruct.logger.severe("[Environment Checks] Bukkit implementation detected. This may be crashy. Bukkit implementations include Craftbukkit and MCPC+."); modIds.add("bukkit"); } - } catch (Exception ex) { + } + catch (Exception ex) + { // No Bukkit in environment. } - if (modIds.size() == 0) { + if (modIds.size() == 0) + { ICrashCallable callable = new CallableSuppConfig(); FMLCommonHandler.instance().registerCrashCallable(callable); - } else { + } + else + { ICrashCallable callable = new CallableUnsuppConfig(modIds); FMLCommonHandler.instance().registerCrashCallable(callable); } diff --git a/src/tconstruct/util/TDispenserBehaviorArrow.java b/src/tconstruct/util/TDispenserBehaviorArrow.java index ba78bf4f..c8e2575a 100644 --- a/src/tconstruct/util/TDispenserBehaviorArrow.java +++ b/src/tconstruct/util/TDispenserBehaviorArrow.java @@ -12,33 +12,34 @@ import tconstruct.entity.projectile.ArrowEntity; public class TDispenserBehaviorArrow extends BehaviorDefaultDispenseItem { - public ItemStack dispenseStack(IBlockSource dispenser, ItemStack stack) + public ItemStack dispenseStack (IBlockSource dispenser, ItemStack stack) { World world = dispenser.getWorld(); IPosition iposition = BlockDispenser.getIPositionFromBlockSource(dispenser); EnumFacing enumfacing = BlockDispenser.getFacing(dispenser.getBlockMetadata()); - + ItemStack arrowItem = stack.splitStack(1); ArrowEntity projectile = new ArrowEntity(world, iposition.getX(), iposition.getY(), iposition.getZ(), arrowItem); projectile.canBePickedUp = 1; - projectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a()); + projectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), + this.func_82498_a()); world.spawnEntityInWorld(projectile); - + return stack; } - protected void playDispenseSound(IBlockSource dispenser) + protected void playDispenseSound (IBlockSource dispenser) { dispenser.getWorld().playAuxSFX(1002, dispenser.getXInt(), dispenser.getYInt(), dispenser.getZInt(), 0); } - protected float func_82498_a() + protected float func_82498_a () { return 6.0F; } - protected float func_82500_b() + protected float func_82500_b () { return 1.1F; } diff --git a/src/tconstruct/util/config/AEImcHandler.java b/src/tconstruct/util/config/AEImcHandler.java index be6bdc5f..c0424667 100644 --- a/src/tconstruct/util/config/AEImcHandler.java +++ b/src/tconstruct/util/config/AEImcHandler.java @@ -7,38 +7,15 @@ import cpw.mods.fml.common.event.FMLInterModComms; public class AEImcHandler { - private static List spatialIOLogics = Arrays.asList( - "AdaptiveSmelteryLogic", - "AdvancedDrawbridgeLogic", - "AqueductLogic", - "CastingBasinLogic", - "CastingChannelLogic", - "CastingTableLogic", - "CraftingStationLogic", - "DrawbridgeLogic", - "DryingRackLogic", - "EssenceExtractorLogic", - "FaucetLogic", - "FirestarterLogic", - "FrypanLogic", - "GolemPedestalLogic", - "LavaTankLogic", - "PartBuilderLogic", - "PatternChestLogic", - "RedwireLogic", - "SmelteryDrainLogic", - "SmelteryLogic", - "StencilTableLogic", - "TankAirLogic", - "TileEntityLandmine", - "ToolForgeLogic", - "ToolStationLogic", - "TowerFurnaceLogic", - "MultiServantLogic" - ); + private static List spatialIOLogics = Arrays.asList("AdaptiveSmelteryLogic", "AdvancedDrawbridgeLogic", "AqueductLogic", "CastingBasinLogic", "CastingChannelLogic", "CastingTableLogic", + "CraftingStationLogic", "DrawbridgeLogic", "DryingRackLogic", "EssenceExtractorLogic", "FaucetLogic", "FirestarterLogic", "FrypanLogic", "GolemPedestalLogic", "LavaTankLogic", + "PartBuilderLogic", "PatternChestLogic", "RedwireLogic", "SmelteryDrainLogic", "SmelteryLogic", "StencilTableLogic", "TankAirLogic", "TileEntityLandmine", "ToolForgeLogic", + "ToolStationLogic", "TowerFurnaceLogic", "MultiServantLogic"); - public static void registerForSpatialIO() { - for (String s : spatialIOLogics) { + public static void registerForSpatialIO () + { + for (String s : spatialIOLogics) + { FMLInterModComms.sendMessage("AppliedEnergistics", "movabletile", "tconstruct.blocks.logic." + s); } } diff --git a/src/tconstruct/util/config/DimensionBlacklist.java b/src/tconstruct/util/config/DimensionBlacklist.java index f8556174..9f5c3b26 100644 --- a/src/tconstruct/util/config/DimensionBlacklist.java +++ b/src/tconstruct/util/config/DimensionBlacklist.java @@ -2,7 +2,6 @@ package tconstruct.util.config; import java.util.ArrayList; - public class DimensionBlacklist { public static ArrayList blacklist = new ArrayList(); diff --git a/src/tconstruct/util/config/MystImcHandler.java b/src/tconstruct/util/config/MystImcHandler.java index 79340c36..bcaef50a 100644 --- a/src/tconstruct/util/config/MystImcHandler.java +++ b/src/tconstruct/util/config/MystImcHandler.java @@ -10,7 +10,7 @@ import tconstruct.common.TContent; public class MystImcHandler { private static String[] FluidBlackList = new String[] { "invar.molten", "electrum.molten", "bronze.molten", "aluminumbrass.molten", "manyullyn.molten", "alumite.molten", "cobalt.molten", - "moltenArdite", "ender", "steel.molten", "platinum.molten"};// = new String[](); + "moltenArdite", "ender", "steel.molten", "platinum.molten" };// = new String[](); private static ArrayList additionalFluids = new ArrayList(); public static void addFluidToBlacklist (String fluidName) @@ -20,8 +20,9 @@ public class MystImcHandler public static void blacklistFluids () { - for (String nm :additionalFluids){ - // check if exists?? + for (String nm : additionalFluids) + { + // check if exists?? SendFluidIMCBLMsg(nm); } for (String nm : FluidBlackList) diff --git a/src/tconstruct/util/config/PHConstruct.java b/src/tconstruct/util/config/PHConstruct.java index 30858a15..2540d427 100644 --- a/src/tconstruct/util/config/PHConstruct.java +++ b/src/tconstruct/util/config/PHConstruct.java @@ -101,10 +101,10 @@ public class PHConstruct barricadeSpruce = config.getBlock("Spruce Barricade", 1482).getInt(1482); barricadeBirch = config.getBlock("Birch Barricade", 1483).getInt(1483); barricadeJungle = config.getBlock("Jungle Barricade", 1487).getInt(1487); - + slimeChannel = config.getBlock("Slime Channel", 3190).getInt(3190); slimePad = config.getBlock("Slime Pad", 3191).getInt(3191); - + furnaceSlab = config.getBlock("Furnace Slab", 3192).getInt(3192); //Thermal Expansion @@ -134,7 +134,7 @@ public class PHConstruct moltenEnder = config.getBlock("Molten Ender", 3218).getInt(3218); terraformer = config.getBlock("Terraformer", 3219).getInt(3219); - + signalBus = config.getBlock("Signal Bus", 3221).getInt(3221); signalTerminal = config.getBlock("Signal Terminal", 3222).getInt(3222); glass = config.getBlock("Clear Glass", 3223).getInt(3223); @@ -268,7 +268,7 @@ public class PHConstruct spoolWire = config.getItem("Logic", "SpoolWire", 14120).getInt(14120); lengthWire = config.getItem("Logic", "LengthWire", 14121).getInt(14121); - + boolean ic2 = true; boolean xycraft = true; try @@ -367,9 +367,10 @@ public class PHConstruct connectedTexturesMode = conTexMode.getInt(2); //dimension blacklist - cfgDimBlackList = config.get("DimBlackList", "SlimeIslandDimBlacklist", new int[] {},"Add dimension ID's to prevent slime islands from generating in them").getIntList(); - slimeIslGenDim0Only = config.get("DimBlackList", "GenerateSlimeIslandInDim0Only", false,"True: slime islands wont generate in any ages other than overworld(if enabled); False: will generate in all non-blackisted ages").getBoolean(false); - slimeIslGenDim0 = config.get("DimBlackList", "slimeIslGenDim0", true,"True: slime islands generate in overworld; False they do not generate").getBoolean(true); + cfgDimBlackList = config.get("DimBlackList", "SlimeIslandDimBlacklist", new int[] {}, "Add dimension ID's to prevent slime islands from generating in them").getIntList(); + slimeIslGenDim0Only = config.get("DimBlackList", "GenerateSlimeIslandInDim0Only", false, + "True: slime islands wont generate in any ages other than overworld(if enabled); False: will generate in all non-blackisted ages").getBoolean(false); + slimeIslGenDim0 = config.get("DimBlackList", "slimeIslGenDim0", true, "True: slime islands generate in overworld; False they do not generate").getBoolean(true); genIslandsFlat = config.get("DimBlacklist", "genIslandsFlat", false, "Generate slime islands in flat worlds").getBoolean(false); //Experimental functionality @@ -417,7 +418,7 @@ public class PHConstruct public static int dryingRack; public static int woodenRail; - + public static int signalBus; public static int signalTerminal; @@ -589,7 +590,7 @@ public class PHConstruct public static int knapsack; public static int heartCanister; - + public static int spoolWire; public static int lengthWire; diff --git a/src/tconstruct/util/landmine/behavior/BehaviorFirework.java b/src/tconstruct/util/landmine/behavior/BehaviorFirework.java index d6e8a7a7..2ef82441 100644 --- a/src/tconstruct/util/landmine/behavior/BehaviorFirework.java +++ b/src/tconstruct/util/landmine/behavior/BehaviorFirework.java @@ -19,12 +19,13 @@ public class BehaviorFirework extends Behavior @Override public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved) { - EnumFacing facing = getFacing(par1World, par2, par3, par4); - + EnumFacing facing = getFacing(par1World, par2, par3, par4); + for (int i = 0; i < par5ItemStack.stackSize; i++) { - //TODO entity registration and stuffs - EntityLandmineFirework entityfireworkrocket = new EntityLandmineFirework(par1World, (double) par2, (double) par3, (double) par4, par5ItemStack, facing.ordinal()).setRider(i == 0 ? triggerer : null); + //TODO entity registration and stuffs + EntityLandmineFirework entityfireworkrocket = new EntityLandmineFirework(par1World, (double) par2, (double) par3, (double) par4, par5ItemStack, facing.ordinal()) + .setRider(i == 0 ? triggerer : null); par1World.spawnEntityInWorld(entityfireworkrocket); boolean shouldRun = true; diff --git a/src/tconstruct/util/network/TPacketHandler.java b/src/tconstruct/util/network/TPacketHandler.java index 632e7b57..00db4e71 100644 --- a/src/tconstruct/util/network/TPacketHandler.java +++ b/src/tconstruct/util/network/TPacketHandler.java @@ -139,49 +139,49 @@ public class TPacketHandler implements IPacketHandler ((DrawbridgeLogic) te).setPlacementDirection(direction); } } - + else if (packetID == 10) //Double jump { //String user = inputStream.readUTF(); //EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user); player.fallDistance = 0; } - + else if (packetID == 11) //Smeltery { - int dimension = inputStream.readInt(); - World world = DimensionManager.getWorld(dimension); - int x = inputStream.readInt(); - int y = inputStream.readInt(); - int z = inputStream.readInt(); - - boolean isShiftPressed = inputStream.readBoolean(); - int fluidID = inputStream.readInt(); - - TileEntity te = world.getBlockTileEntity(x, y, z); - - if (te instanceof SmelteryLogic) - { - FluidStack temp = null; - - for(FluidStack liquid : ((SmelteryLogic) te).moltenMetal) - { - if (liquid.fluidID == fluidID) - { - temp = liquid; - } - } - - if (temp != null) - { - ((SmelteryLogic) te).moltenMetal.remove(temp); - if (isShiftPressed) - ((SmelteryLogic) te).moltenMetal.add(temp); - else - ((SmelteryLogic) te).moltenMetal.add(0, temp); - } - PacketDispatcher.sendPacketToAllInDimension(te.getDescriptionPacket(), dimension); - } + int dimension = inputStream.readInt(); + World world = DimensionManager.getWorld(dimension); + int x = inputStream.readInt(); + int y = inputStream.readInt(); + int z = inputStream.readInt(); + + boolean isShiftPressed = inputStream.readBoolean(); + int fluidID = inputStream.readInt(); + + TileEntity te = world.getBlockTileEntity(x, y, z); + + if (te instanceof SmelteryLogic) + { + FluidStack temp = null; + + for (FluidStack liquid : ((SmelteryLogic) te).moltenMetal) + { + if (liquid.fluidID == fluidID) + { + temp = liquid; + } + } + + if (temp != null) + { + ((SmelteryLogic) te).moltenMetal.remove(temp); + if (isShiftPressed) + ((SmelteryLogic) te).moltenMetal.add(temp); + else + ((SmelteryLogic) te).moltenMetal.add(0, temp); + } + PacketDispatcher.sendPacketToAllInDimension(te.getDescriptionPacket(), dimension); + } } } catch (IOException e) diff --git a/src/tconstruct/worldgen/SlimeIslandGen.java b/src/tconstruct/worldgen/SlimeIslandGen.java index 730bbd92..82f51a5c 100644 --- a/src/tconstruct/worldgen/SlimeIslandGen.java +++ b/src/tconstruct/worldgen/SlimeIslandGen.java @@ -36,10 +36,11 @@ public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator public void generate (Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) //IWorldGenerator version { //dim 0 only? - if ((chunkGenerator instanceof ChunkProviderFlat || world.provider.terrainType == WorldType.FLAT) && PHConstruct.genIslandsFlat) { + if ((chunkGenerator instanceof ChunkProviderFlat || world.provider.terrainType == WorldType.FLAT) && PHConstruct.genIslandsFlat) + { return; } - + if (DimensionBlacklist.isDimInBlacklist(world.provider.dimensionId)) { if (random.nextInt(PHConstruct.islandRarity) == 0) diff --git a/src/tconstruct/worldgen/village/ComponentSmeltery.java b/src/tconstruct/worldgen/village/ComponentSmeltery.java index 1dff0da0..714207e6 100644 --- a/src/tconstruct/worldgen/village/ComponentSmeltery.java +++ b/src/tconstruct/worldgen/village/ComponentSmeltery.java @@ -17,8 +17,10 @@ import net.minecraft.world.gen.structure.StructureComponent; public class ComponentSmeltery extends ComponentVillage { private int averageGroundLevel = -1; - - public ComponentSmeltery() {} + + public ComponentSmeltery() + { + } public ComponentSmeltery(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) { diff --git a/src/tconstruct/worldgen/village/ComponentToolWorkshop.java b/src/tconstruct/worldgen/village/ComponentToolWorkshop.java index 33bf566f..d4f53c54 100644 --- a/src/tconstruct/worldgen/village/ComponentToolWorkshop.java +++ b/src/tconstruct/worldgen/village/ComponentToolWorkshop.java @@ -18,8 +18,10 @@ import net.minecraft.world.gen.structure.StructureComponent; public class ComponentToolWorkshop extends ComponentVillage { private int averageGroundLevel = -1; - - public ComponentToolWorkshop() {} + + public ComponentToolWorkshop() + { + } public ComponentToolWorkshop(ComponentVillageStartPiece par1ComponentVillageStartPiece, int par2, Random par3Random, StructureBoundingBox par4StructureBoundingBox, int par5) { diff --git a/src/tconstruct/worldgen/village/TVillageTrades.java b/src/tconstruct/worldgen/village/TVillageTrades.java index 8f73c0bf..d76e2a2f 100644 --- a/src/tconstruct/worldgen/village/TVillageTrades.java +++ b/src/tconstruct/worldgen/village/TVillageTrades.java @@ -15,32 +15,34 @@ import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; public class TVillageTrades implements IVillageTradeHandler { - private final List allowedIngredients = new ArrayList(); - private final int max = 17; - private final int min = 7; + private final List allowedIngredients = new ArrayList(); + private final int max = 17; + private final int min = 7; - public TVillageTrades() { - super(); + public TVillageTrades() + { + super(); - // vanilla blocks - allowedIngredients.add(new ItemStack(Block.pistonBase, 64)); - allowedIngredients.add(new ItemStack(Block.pistonStickyBase, 64)); + // vanilla blocks + allowedIngredients.add(new ItemStack(Block.pistonBase, 64)); + allowedIngredients.add(new ItemStack(Block.pistonStickyBase, 64)); + + // tconstruct blocks + allowedIngredients.add(new ItemStack(TContent.barricadeBirch, 64)); + allowedIngredients.add(new ItemStack(TContent.barricadeJungle, 64)); + allowedIngredients.add(new ItemStack(TContent.barricadeOak, 64)); + allowedIngredients.add(new ItemStack(TContent.barricadeSpruce, 64)); + allowedIngredients.add(new ItemStack(TContent.punji, 64)); + allowedIngredients.add(new ItemStack(TContent.toolStationWood, 3, 0)); + allowedIngredients.add(new ItemStack(TContent.toolStationWood, 3, 1)); + allowedIngredients.add(new ItemStack(TContent.toolStationWood, 3, 5)); + allowedIngredients.add(new ItemStack(TContent.toolStationWood, 3, 10)); + for (int sc = 0; sc < 4; sc++) + { + allowedIngredients.add(new ItemStack(TContent.landmine, 64, sc)); + } + } - // tconstruct blocks - allowedIngredients.add(new ItemStack(TContent.barricadeBirch, 64)); - allowedIngredients.add(new ItemStack(TContent.barricadeJungle, 64)); - allowedIngredients.add(new ItemStack(TContent.barricadeOak, 64)); - allowedIngredients.add(new ItemStack(TContent.barricadeSpruce, 64)); - allowedIngredients.add(new ItemStack(TContent.punji, 64)); - allowedIngredients.add(new ItemStack(TContent.toolStationWood, 3, 0)); - allowedIngredients.add(new ItemStack(TContent.toolStationWood, 3, 1)); - allowedIngredients.add(new ItemStack(TContent.toolStationWood, 3, 5)); - allowedIngredients.add(new ItemStack(TContent.toolStationWood, 3, 10)); - for (int sc = 0; sc < 4; sc++) { - allowedIngredients.add(new ItemStack(TContent.landmine, 64, sc)); - } - } - @Override public void manipulateTradesForVillager (EntityVillager villager, MerchantRecipeList recipeList, Random random) { @@ -50,20 +52,25 @@ public class TVillageTrades implements IVillageTradeHandler ItemStack ingredient2; ItemStack result; - for (int sc = 8; sc < 12; sc++) { + for (int sc = 8; sc < 12; sc++) + { int num = getNextInt(random, min, max); ingredient = getIngredient(random, num); - if (ingredient.stackSize < 13) { + if (ingredient.stackSize < 13) + { ingredient2 = getIngredient(random, ingredient); - } else { + } + else + { ingredient2 = null; } result = new ItemStack(TContent.oreBerry, calcStackSize(ingredient, ingredient2), sc); // adds iron, gold, copper & tin orebushes to the recipe list recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result)); - if (sc == 8) { + if (sc == 8) + { // adds alumine orebush to the recipe list result = new ItemStack(TContent.oreBerrySecond, calcStackSize(ingredient, ingredient2), sc); recipeList.addToListWithCheck(new MerchantRecipe(ingredient, ingredient2, result)); @@ -72,41 +79,47 @@ public class TVillageTrades implements IVillageTradeHandler } } - private int calcStackSize(ItemStack ingredient, ItemStack ingredient2) { - if (ingredient == null) return 1; + private int calcStackSize (ItemStack ingredient, ItemStack ingredient2) + { + if (ingredient == null) + return 1; int num = ingredient.stackSize; - if (ingredient2 != null) + if (ingredient2 != null) num += ingredient2.stackSize; - + return Math.max(1, Math.round((num - 5) / 4)); } - private ItemStack getIngredient(Random random, ItemStack ingredient) { + private ItemStack getIngredient (Random random, ItemStack ingredient) + { int sc; ItemStack is; int tries = 0; - while (true) { + while (true) + { sc = getNextInt(random, 0, allowedIngredients.size() - 1); is = allowedIngredients.get(sc); if (is.itemID != ingredient.itemID || is.getItemDamage() != ingredient.getItemDamage()) break; - + tries++; if (tries == 5) return null; - } - int num = getNextInt(random, 0, Math.min(is.stackSize , max - ingredient.stackSize)); - return is.copy().splitStack(num); - } - - private ItemStack getIngredient(Random random, int num) { - int sc = getNextInt(random, 0, allowedIngredients.size() - 1); - ItemStack item = allowedIngredients.get(sc); - return item.copy().splitStack(Math.min(num, item.stackSize)); + } + int num = getNextInt(random, 0, Math.min(is.stackSize, max - ingredient.stackSize)); + return is.copy().splitStack(num); } - private int getNextInt(Random random, int min, int max) { + private ItemStack getIngredient (Random random, int num) + { + int sc = getNextInt(random, 0, allowedIngredients.size() - 1); + ItemStack item = allowedIngredients.get(sc); + return item.copy().splitStack(Math.min(num, item.stackSize)); + } + + private int getNextInt (Random random, int min, int max) + { return random.nextInt(Math.max(1, (max - min) + 1)) + min; } } diff --git a/src/tconstruct/worldgen/village/VillageToolStationHandler.java b/src/tconstruct/worldgen/village/VillageToolStationHandler.java index ea87911e..313736a4 100644 --- a/src/tconstruct/worldgen/village/VillageToolStationHandler.java +++ b/src/tconstruct/worldgen/village/VillageToolStationHandler.java @@ -10,7 +10,7 @@ import net.minecraft.world.gen.structure.StructureVillagePieceWeight; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler; public class VillageToolStationHandler implements IVillageCreationHandler -{ +{ @Override public StructureVillagePieceWeight getVillagePieceWeight (Random random, int i) {