diff --git a/mods/tinker/tconstruct/TConstruct.java b/mods/tinker/tconstruct/TConstruct.java index 433810e2..75107fad 100644 --- a/mods/tinker/tconstruct/TConstruct.java +++ b/mods/tinker/tconstruct/TConstruct.java @@ -38,7 +38,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry; * @dependencies: IC2 API, MFR API */ -@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.4", dependencies = "required-after:Forge@[7.7.1.675,)") +@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.4.5", dependencies = "required-after:Forge@[7.7.1.675,)") @NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.util.network.TPacketHandler.class) public class TConstruct { @@ -107,8 +107,8 @@ public class TConstruct content.modIntegration(); content.createEntities(); - SkillRegistry.registerSkill("Wall Building", new WallBuilding()); - SkillRegistry.registerSkill("Jump", new Jump()); + /*SkillRegistry.registerSkill("Wall Building", new WallBuilding()); + SkillRegistry.registerSkill("Jump", new Jump());*/ } public static LiquidCasting getTableCasting() diff --git a/mods/tinker/tconstruct/blocks/OreberryBush.java b/mods/tinker/tconstruct/blocks/OreberryBush.java index 5a6f1e6a..2a55fcd5 100644 --- a/mods/tinker/tconstruct/blocks/OreberryBush.java +++ b/mods/tinker/tconstruct/blocks/OreberryBush.java @@ -29,317 +29,320 @@ import cpw.mods.fml.relauncher.SideOnly; public class OreberryBush extends BlockLeavesBase implements IPlantable { - Random random; - public Icon[] fastIcons; - public Icon[] fancyIcons; - public String[] textureNames; - public String[] oreTypes; - public int itemMeat; - private int subitems; + Random random; + public Icon[] fastIcons; + public Icon[] fancyIcons; + public String[] textureNames; + public String[] oreTypes; + public int itemMeat; + private int subitems; - public OreberryBush(int id, String[] textureNames, int meta, int sub, String[] oreTypes) - { - super(id, Material.leaves, false); - this.textureNames = textureNames; - this.itemMeat = meta; - this.subitems = sub; - this.oreTypes = oreTypes; - this.setTickRandomly(true); - random = new Random(); - this.setHardness(0.3F); - this.setStepSound(Block.soundMetalFootstep); - this.setCreativeTab(TConstructRegistry.blockTab); - } + public OreberryBush(int id, String[] textureNames, int meta, int sub, String[] oreTypes) + { + super(id, Material.leaves, false); + this.textureNames = textureNames; + this.itemMeat = meta; + this.subitems = sub; + this.oreTypes = oreTypes; + this.setTickRandomly(true); + random = new Random(); + this.setHardness(0.3F); + this.setStepSound(Block.soundMetalFootstep); + this.setCreativeTab(TConstructRegistry.blockTab); + } - /* Berries show up at meta 12-15 */ + /* Berries show up at meta 12-15 */ - @SideOnly(Side.CLIENT) - @Override - public void registerIcons (IconRegister iconRegister) - { - this.fastIcons = new Icon[textureNames.length]; - this.fancyIcons = new Icon[textureNames.length]; + @SideOnly(Side.CLIENT) + @Override + public void registerIcons (IconRegister iconRegister) + { + this.fastIcons = new Icon[textureNames.length]; + this.fancyIcons = new Icon[textureNames.length]; - for (int i = 0; i < this.fastIcons.length; i++) - { - this.fastIcons[i] = iconRegister.registerIcon("tinker:crops/" + textureNames[i] + "_fast"); - this.fancyIcons[i] = iconRegister.registerIcon("tinker:crops/" + textureNames[i] + "_fancy"); - } - } + for (int i = 0; i < this.fastIcons.length; i++) + { + if (textureNames[i] != "") + { + this.fastIcons[i] = iconRegister.registerIcon("tinker:crops/" + textureNames[i] + "_fast"); + this.fancyIcons[i] = iconRegister.registerIcon("tinker:crops/" + textureNames[i] + "_fancy"); + } + } + } - @Override - public Icon getIcon (int side, int metadata) - { - if (graphicsLevel) - { - if (metadata < 12) - { - return fancyIcons[metadata % 4]; - } - else - { - return fancyIcons[metadata % 4 + 4]; - } - } - else - { - if (metadata < 12) - { - return fastIcons[metadata % 4]; - } - else - { - return fastIcons[metadata % 4 + 4]; - } - } - } + @Override + public Icon getIcon (int side, int metadata) + { + if (graphicsLevel) + { + if (metadata < 12) + { + return fancyIcons[metadata % 4]; + } + else + { + return fancyIcons[metadata % 4 + 4]; + } + } + else + { + if (metadata < 12) + { + return fastIcons[metadata % 4]; + } + else + { + return fastIcons[metadata % 4 + 4]; + } + } + } - /* Bushes are stored by size then type */ - @Override - public int damageDropped (int metadata) - { - return metadata % 4; - } + /* Bushes are stored by size then type */ + @Override + public int damageDropped (int metadata) + { + return metadata % 4; + } - /* The following methods define a berry bush's size depending on metadata */ - @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z) - { - int l = world.getBlockMetadata(x, y, z); - if (l < 4) - { - return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D); - } - else if (l < 8) - { - return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D); - } - else - { - return AxisAlignedBB.getBoundingBox(x+0.0625, y, z+0.0625, (double) x + 0.9375D, (double) y + 0.9375D, (double) z + 0.9375D); - } - } + /* The following methods define a berry bush's size depending on metadata */ + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z) + { + int l = world.getBlockMetadata(x, y, z); + if (l < 4) + { + return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D); + } + else if (l < 8) + { + return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D); + } + else + { + return AxisAlignedBB.getBoundingBox(x + 0.0625, y, z + 0.0625, (double) x + 0.9375D, (double) y + 0.9375D, (double) z + 0.9375D); + } + } - public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z) - { - int l = world.getBlockMetadata(x, y, z); - if (l < 4) - { - return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D); - } - else if (l < 8) - { - return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D); - } - else - { - return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 1.0D, (double) z + 1.0D); - } - } + public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z) + { + int l = world.getBlockMetadata(x, y, z); + if (l < 4) + { + return AxisAlignedBB.getBoundingBox((double) x + 0.25D, y, (double) z + 0.25D, (double) x + 0.75D, (double) y + 0.5D, (double) z + 0.75D); + } + else if (l < 8) + { + return AxisAlignedBB.getBoundingBox((double) x + 0.125D, y, (double) z + 0.125D, (double) x + 0.875D, (double) y + 0.75D, (double) z + 0.875D); + } + else + { + return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 1.0D, (double) z + 1.0D); + } + } - @Override - public void setBlockBoundsBasedOnState (IBlockAccess iblockaccess, int x, int y, int z) - { - int md = iblockaccess.getBlockMetadata(x, y, z); + @Override + public void setBlockBoundsBasedOnState (IBlockAccess iblockaccess, int x, int y, int z) + { + int md = iblockaccess.getBlockMetadata(x, y, z); - float minX; - float minY = 0F; - float minZ; - float maxX; - float maxY; - float maxZ; + float minX; + float minY = 0F; + float minZ; + float maxX; + float maxY; + float maxZ; - if (md < 4) - { - minX = minZ = 0.25F; - maxX = maxZ = 0.75F; - maxY = 0.5F; - } - else + if (md < 4) + { + minX = minZ = 0.25F; + maxX = maxZ = 0.75F; + maxY = 0.5F; + } + else - if (md < 8) - { - minX = minZ = 0.125F; - maxX = maxZ = 0.875F; - maxY = 0.75F; - } + if (md < 8) + { + minX = minZ = 0.125F; + maxX = maxZ = 0.875F; + maxY = 0.75F; + } - else - { - minX = minZ = 0.0F; - maxX = maxZ = 1.0F; - maxY = 1.0F; - } - setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); - } + else + { + minX = minZ = 0.0F; + maxX = maxZ = 1.0F; + maxY = 1.0F; + } + setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ); + } - /* Left-click harvests berries */ - @Override - public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player) - { - if (!world.isRemote) - { - int meta = world.getBlockMetadata(x, y, z); - if (meta >= 12) - { - world.setBlock(x, y, z, blockID, meta - 4, 3); - AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.oreBerries, 1, meta % 4 + itemMeat)); - } - } - } + /* Left-click harvests berries */ + @Override + public void onBlockClicked (World world, int x, int y, int z, EntityPlayer player) + { + if (!world.isRemote) + { + int meta = world.getBlockMetadata(x, y, z); + if (meta >= 12) + { + world.setBlock(x, y, z, blockID, meta - 4, 3); + AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.oreBerries, 1, meta % 4 + itemMeat)); + } + } + } - /* Right-click harvests berries */ - @Override - public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) - { - /*if (world.isRemote) - return false;*/ + /* Right-click harvests berries */ + @Override + public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) + { + /*if (world.isRemote) + return false;*/ - int meta = world.getBlockMetadata(x, y, z); - if (meta >= 12) - { - if (world.isRemote) - return true; - - world.setBlock(x, y, z, blockID, meta - 4, 3); - AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.oreBerries, 1, meta % 4 + itemMeat)); - return true; - } - - return false; - } + int meta = world.getBlockMetadata(x, y, z); + if (meta >= 12) + { + if (world.isRemote) + return true; - /* Render logic */ + world.setBlock(x, y, z, blockID, meta - 4, 3); + AbilityHelper.spawnItemAtPlayer(player, new ItemStack(TContent.oreBerries, 1, meta % 4 + itemMeat)); + return true; + } - @Override - public boolean isOpaqueCube () - { - return false; - } + return false; + } - public void setGraphicsLevel (boolean flag) - { - graphicsLevel = flag; - } + /* Render logic */ - @Override - public boolean renderAsNormalBlock () - { - return false; - } + @Override + public boolean isOpaqueCube () + { + return false; + } - public int getRenderType () - { - return OreberryRender.model; - } + public void setGraphicsLevel (boolean flag) + { + graphicsLevel = flag; + } - public boolean shouldSideBeRendered (IBlockAccess iblockaccess, int x, int y, int z, int meta) - { - if (meta > 7 || graphicsLevel) - { - return super.shouldSideBeRendered(iblockaccess, x, y, z, meta); - } - else - { - return true; - } - } + @Override + public boolean renderAsNormalBlock () + { + return false; + } - /* Bush growth */ + public int getRenderType () + { + return OreberryRender.model; + } - @Override - public void updateTick (World world, int x, int y, int z, Random random1) - { - if (world.isRemote) - { - return; - } + public boolean shouldSideBeRendered (IBlockAccess iblockaccess, int x, int y, int z, int meta) + { + if (meta > 7 || graphicsLevel) + { + return super.shouldSideBeRendered(iblockaccess, x, y, z, meta); + } + else + { + return true; + } + } - if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <= 8) - { - int meta = world.getBlockMetadata(x, y, z); - if (world.getFullBlockLightValue(x, y, z) < 10) - { - if (meta < 12) - { - world.setBlock(x, y, z, blockID, meta + 4, 3); - } - } - else if (meta < 8) - { - world.setBlock(x, y, z, blockID, meta + 4, 3); - } - } - } - - public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant) - { - if (plant instanceof OreberryBush) - return (world.getBlockMetadata(x, y, z) > 7); - return super.canSustainPlant(world, x, y, z, direction, plant); - } - - public boolean canPlaceBlockAt(World world, int x, int y, int z) - { - if (world.getFullBlockLightValue(x, y, z) < 13) - return super.canPlaceBlockAt(world, x, y, z); - return false; - } + /* Bush growth */ - /* Resistance to fire */ + @Override + public void updateTick (World world, int x, int y, int z, Random random1) + { + if (world.isRemote) + { + return; + } - @Override - public int getFlammability (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) - { - return 0; - } + if (random1.nextInt(20) == 0)// && world.getBlockLightValue(x, y, z) <= 8) + { + int meta = world.getBlockMetadata(x, y, z); + if (world.getFullBlockLightValue(x, y, z) < 10) + { + if (meta < 12) + { + world.setBlock(x, y, z, blockID, meta + 4, 3); + } + } + else if (meta < 8) + { + world.setBlock(x, y, z, blockID, meta + 4, 3); + } + } + } - @Override - public boolean isFlammable (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) - { - return false; - } + public boolean canSustainPlant (World world, int x, int y, int z, ForgeDirection direction, IPlantable plant) + { + if (plant instanceof OreberryBush) + return (world.getBlockMetadata(x, y, z) > 7); + return super.canSustainPlant(world, x, y, z, direction, plant); + } - @Override - public int getFireSpreadSpeed (World world, int x, int y, int z, int metadata, ForgeDirection face) - { - return 0; - } + public boolean canPlaceBlockAt (World world, int x, int y, int z) + { + if (world.getFullBlockLightValue(x, y, z) < 13) + return super.canPlaceBlockAt(world, x, y, z); + return false; + } - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - @SideOnly(Side.CLIENT) - @Override - public void getSubBlocks (int par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int var4 = 8; var4 < 8+subitems; ++var4) - { - par3List.add(new ItemStack(par1, 1, var4)); - } - } + /* Resistance to fire */ - @Override - public EnumPlantType getPlantType (World world, int x, int y, int z) - { - return EnumPlantType.Cave; - } + @Override + public int getFlammability (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) + { + return 0; + } - @Override - public int getPlantID (World world, int x, int y, int z) - { - return this.blockID; - } + @Override + public boolean isFlammable (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) + { + return false; + } - @Override - public int getPlantMetadata (World world, int x, int y, int z) - { - return world.getBlockMetadata(x, y, z) - 4; - } - - public void onEntityCollidedWithBlock (World world, int i, int j, int k, Entity entity) - { - if (!(entity instanceof EntityItem)) - entity.attackEntityFrom(DamageSource.cactus, 1); - } + @Override + public int getFireSpreadSpeed (World world, int x, int y, int z, int metadata, ForgeDirection face) + { + return 0; + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) + */ + @SideOnly(Side.CLIENT) + @Override + public void getSubBlocks (int par1, CreativeTabs par2CreativeTabs, List par3List) + { + for (int var4 = 8; var4 < 8 + subitems; ++var4) + { + par3List.add(new ItemStack(par1, 1, var4)); + } + } + + @Override + public EnumPlantType getPlantType (World world, int x, int y, int z) + { + return EnumPlantType.Cave; + } + + @Override + public int getPlantID (World world, int x, int y, int z) + { + return this.blockID; + } + + @Override + public int getPlantMetadata (World world, int x, int y, int z) + { + return world.getBlockMetadata(x, y, z) - 4; + } + + public void onEntityCollidedWithBlock (World world, int i, int j, int k, Entity entity) + { + if (!(entity instanceof EntityItem)) + entity.attackEntityFrom(DamageSource.cactus, 1); + } } diff --git a/mods/tinker/tconstruct/blocks/logic/FaucetLogic.java b/mods/tinker/tconstruct/blocks/logic/FaucetLogic.java index 989c3be1..7107cf35 100644 --- a/mods/tinker/tconstruct/blocks/logic/FaucetLogic.java +++ b/mods/tinker/tconstruct/blocks/logic/FaucetLogic.java @@ -47,8 +47,25 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi if (drainte != null && drainte instanceof ITankContainer && tankte != null && tankte instanceof ITankContainer) { - liquid = ((ITankContainer) drainte).drain(getForgeDirection(), TConstruct.ingotLiquidValue, true); - if (liquid != null) + LiquidStack templiquid = ((ITankContainer) drainte).drain(getForgeDirection(), TConstruct.ingotLiquidValue, false); + System.out.println("Rawr "+templiquid); + if (templiquid != null) + { + int drained = ((ITankContainer) tankte).fill(ForgeDirection.UP, templiquid, false); + if (drained > 0) + { + liquid = ((ITankContainer) drainte).drain(getForgeDirection(), drained, true); + ((ITankContainer) tankte).fill(ForgeDirection.UP, liquid, true); + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + return true; + } + else + { + return false; + } + + } + /*if (liquid != null) { int drained = ((ITankContainer) tankte).fill(ForgeDirection.UP, liquid, true); if (drained != liquid.amount) @@ -71,7 +88,7 @@ public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogi else { ((ITankContainer) drainte).fill(getForgeDirection(), liquid, true); - } + }*/ } } return false; diff --git a/mods/tinker/tconstruct/blocks/traps/BarricadeBlock.java b/mods/tinker/tconstruct/blocks/traps/BarricadeBlock.java new file mode 100644 index 00000000..2838ba72 --- /dev/null +++ b/mods/tinker/tconstruct/blocks/traps/BarricadeBlock.java @@ -0,0 +1,92 @@ +package mods.tinker.tconstruct.blocks.traps; + +import mods.tinker.tconstruct.client.block.BarricadeRender; +import mods.tinker.tconstruct.library.TConstructRegistry; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Icon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class BarricadeBlock extends Block +{ + public BarricadeBlock(int blockID)//, String name, int texture) + { + super(blockID, Material.wood); + setHardness(4.0F); + this.setCreativeTab(TConstructRegistry.blockTab); + //setUnlocalizedName("barricade" + name); + //GameRegistry.addName(this, name + " Barricade"); + } + + public Icon getIcon(int side, int meta) + { + return Block.wood.getIcon(2, meta % 4); + } + + public boolean renderAsNormalBlock () + { + return false; + } + + public boolean isOpaqueCube () + { + return false; + } + + public int getRenderType () + { + return BarricadeRender.model; + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int x, int y, int z) + { + return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1); + } + + public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int x, int y, int z) + { + setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public void harvestBlock (World world, EntityPlayer player, int x, int y, int z, int meta) + { + if (meta % 4 > 0) + { + world.setBlock(x, y, z, this.blockID, meta - 1, 3); + dropBlockAsItem_do(world, x, y, z, new ItemStack(this)); + } + else + { + dropBlockAsItem_do(world, x, y, z, new ItemStack(this)); + } + } + + @Override + public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) + { + ItemStack stack = player.getCurrentEquippedItem(); + if ((stack != null) && (stack.itemID == this.blockID) && (!player.isSneaking())) + { + int meta = world.getBlockMetadata(x, y, z); + if (meta % 4 != 3) + { + world.setBlock(x, y, z, this.blockID, meta + 1, 3); + Block.blocksList[this.blockID].onBlockPlacedBy(world, x, y, z, player, stack); + Block.blocksList[this.blockID].onPostBlockPlaced(world, x, y, z, meta); + + Block var9 = Block.blocksList[this.blockID]; + world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var9.stepSound.getStepSound(), (var9.stepSound.getVolume() + 1.0F) / 2.0F, var9.stepSound.getPitch() * 0.8F); + player.swingItem(); + if (!player.capabilities.isCreativeMode) + stack.stackSize -= 1; + + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/mods/tinker/tconstruct/blocks/Landmine.java b/mods/tinker/tconstruct/blocks/traps/Landmine.java similarity index 92% rename from mods/tinker/tconstruct/blocks/Landmine.java rename to mods/tinker/tconstruct/blocks/traps/Landmine.java index 1c36ceab..afc84c8a 100644 --- a/mods/tinker/tconstruct/blocks/Landmine.java +++ b/mods/tinker/tconstruct/blocks/traps/Landmine.java @@ -1,4 +1,4 @@ -package mods.tinker.tconstruct.blocks; +package mods.tinker.tconstruct.blocks.traps; import java.util.Iterator; import java.util.List; @@ -9,10 +9,12 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockFence; import net.minecraft.block.EnumMobType; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -30,6 +32,26 @@ public class Landmine extends Block float var5 = 0.0625F; this.setBlockBounds(var5, 0.0F, var5, 1.0F - var5, 0.03125F, 1.0F - var5); } + + public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side) + { + Block block = Block.blocksList[world.getBlockId(x, y-1, z)]; + if (block != null) + { + return block.getBlockTexture(world, x, y-1, z, side); + } + return Block.sponge.getIcon(side, world.getBlockMetadata(x, y, z)); + } + + public Icon getIcon(int side, int meta) + { + return Block.sponge.getIcon(1, meta); + } + + public void registerIcons(IconRegister par1IconRegister) + { + + } /** * How many world ticks before ticking @@ -169,7 +191,7 @@ public class Landmine extends Block if (var6 && !var5) { - //world.setBlock(posX, posY, posZ, 0); + world.setBlock(posX, posY, posZ, 0); world.createExplosion((Entity)null, posX, posY, posZ, 2.0F, true); /*par1World.setBlockMetadataWithNotify(posX, posY, posZ, 1); par1World.notifyBlocksOfNeighborChange(posX, posY, posZ, this.blockID); diff --git a/mods/tinker/tconstruct/client/TClientEvents.java b/mods/tinker/tconstruct/client/TClientEvents.java index a8aa383a..e6d91b38 100644 --- a/mods/tinker/tconstruct/client/TClientEvents.java +++ b/mods/tinker/tconstruct/client/TClientEvents.java @@ -1,7 +1,5 @@ package mods.tinker.tconstruct.client; -import java.util.List; - import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.client.armor.WingModel; import mods.tinker.tconstruct.common.TContent; @@ -12,13 +10,10 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.model.ModelBiped; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; -import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.liquids.LiquidStack; import org.lwjgl.opengl.GL11; @@ -30,7 +25,6 @@ import cpw.mods.fml.relauncher.SideOnly; public class TClientEvents { Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer player; /*@ForgeSubscribe public void interact (PlayerInteractEvent event) @@ -80,21 +74,19 @@ public class TClientEvents @ForgeSubscribe public void renderHealthbar (RenderGameOverlayEvent.Post event) { - if (player == null) - player = mc.thePlayer; ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); int scaledWidth = scaledresolution.getScaledWidth(); int scaledHeight = scaledresolution.getScaledHeight(); int xBasePos = scaledWidth / 2 - 91; int yBasePos = scaledHeight - 39; - TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); + TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(mc.thePlayer.username); if (event.type == RenderGameOverlayEvent.ElementType.HEALTH) { this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/newhearts.png"); - int hp = player.getHealth(); + int hp = mc.thePlayer.getHealth(); for (int iter = 0; iter < hp / 20; iter++) { int renderHearts = (hp - 20*(iter+1)) / 2; @@ -113,8 +105,11 @@ public class TClientEvents this.mc.renderEngine.bindTexture("/gui/icons.png"); } - if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR) + /*if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR) { + if (stats.skillList == null) + return; + int amount = 0; GL11.glScalef(1/16f, 1/16f, 1/16f); for (Skill skill : stats.skillList) @@ -126,7 +121,7 @@ public class TClientEvents amount++; } GL11.glScalef(16f, 16f, 16f); - } + }*/ } public void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6) diff --git a/mods/tinker/tconstruct/client/TControls.java b/mods/tinker/tconstruct/client/TControls.java index 60922b27..0fb11ff3 100644 --- a/mods/tinker/tconstruct/client/TControls.java +++ b/mods/tinker/tconstruct/client/TControls.java @@ -12,6 +12,7 @@ import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.packet.Packet250CustomPayload; +import net.minecraft.server.MinecraftServer; import cpw.mods.fml.common.TickType; import cpw.mods.fml.common.network.PacketDispatcher; @@ -20,11 +21,11 @@ public class TControls extends TKeyHandler //static KeyBinding grabKey = new KeyBinding("key.grab", 29); //static KeyBinding stiltsKey = new KeyBinding("key.stilts", 46); public static KeyBinding armorKey = new KeyBinding("key.tarmor", 24); - public static KeyBinding skillOne = new KeyBinding("key.skill.one", 44); + /*public static KeyBinding skillOne = new KeyBinding("key.skill.one", 44); public static KeyBinding skillTwo = new KeyBinding("key.skill.two", 45); public static KeyBinding skillThree = new KeyBinding("key.skill.three", 46); public static KeyBinding skillFour = new KeyBinding("key.skill.four", 47); - public static KeyBinding skillFive = new KeyBinding("key.skill.five", 48); + public static KeyBinding skillFive = new KeyBinding("key.skill.five", 48);*/ static KeyBinding jumpKey; static KeyBinding invKey; static Minecraft mc; @@ -39,7 +40,7 @@ public class TControls extends TKeyHandler public TControls() { - super(new KeyBinding[] { armorKey, skillOne, skillTwo, skillThree, skillFour, skillFive }, new boolean[] { false, false, false, false, false, false }, getVanillaKeyBindings(), new boolean[] { + super(new KeyBinding[] { armorKey/*, skillOne, skillTwo, skillThree, skillFour, skillFive*/ }, new boolean[] { false/*, false, false, false, false, false*/ }, getVanillaKeyBindings(), new boolean[] { false, false }); //System.out.println("Controls registered");Natura } @@ -71,7 +72,7 @@ public class TControls extends TKeyHandler { TProxyClient.addTabsToInventory(); } - if (kb == skillOne) + /*if (kb == skillOne) { sendSkillkey(mc.thePlayer, (byte) 0);//, mc.thePlayer.dimension, mc.thePlayer.entityId); } @@ -90,7 +91,7 @@ public class TControls extends TKeyHandler if (kb == skillFive) { sendSkillkey(mc.thePlayer, (byte) 4);//, mc.thePlayer.dimension, mc.thePlayer.entityId); - } + }*/ /*if (kb == jumpKey) //Double jump { if (jumping && !doubleJump) @@ -211,7 +212,7 @@ public class TControls extends TKeyHandler updateServer(bos); } - + /*public void activateSkill (EntityPlayer player, int slot) { if (TProxyClient.skillList.size() > slot) @@ -223,25 +224,29 @@ public class TControls extends TKeyHandler } } }*/ - - public void sendSkillkey (EntityPlayer player, byte key)//, int dim, int id) + + public void sendSkillkey (EntityPlayer player, byte key) { TConstruct.playerTracker.activateSkill(player, key); - ByteArrayOutputStream bos = new ByteArrayOutputStream(8); - DataOutputStream outputStream = new DataOutputStream(bos); - try - { - outputStream.writeByte(4); - //outputStream.writeInt(dim); - //outputStream.writeInt(id); - outputStream.writeByte(key); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - updateServer(bos); + System.out.println(MinecraftServer.getServer()); + if (MinecraftServer.getServer().isDedicatedServer()) + { + System.out.println("Send"); + ByteArrayOutputStream bos = new ByteArrayOutputStream(8); + DataOutputStream outputStream = new DataOutputStream(bos); + try + { + outputStream.writeByte(4); + outputStream.writeByte(key); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + updateServer(bos); + } } static void updateServer (ByteArrayOutputStream bos) diff --git a/mods/tinker/tconstruct/client/TProxyClient.java b/mods/tinker/tconstruct/client/TProxyClient.java index 865d7e1b..64d1ad2e 100644 --- a/mods/tinker/tconstruct/client/TProxyClient.java +++ b/mods/tinker/tconstruct/client/TProxyClient.java @@ -10,65 +10,22 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import mods.tinker.tconstruct.TConstruct; -import mods.tinker.tconstruct.blocks.logic.CastingBasinLogic; -import mods.tinker.tconstruct.blocks.logic.CastingTableLogic; -import mods.tinker.tconstruct.blocks.logic.FrypanLogic; -import mods.tinker.tconstruct.blocks.logic.GolemCoreLogic; -import mods.tinker.tconstruct.blocks.logic.PartCrafterLogic; -import mods.tinker.tconstruct.blocks.logic.PatternChestLogic; -import mods.tinker.tconstruct.blocks.logic.PatternShaperLogic; -import mods.tinker.tconstruct.blocks.logic.SmelteryLogic; -import mods.tinker.tconstruct.blocks.logic.ToolStationLogic; -import mods.tinker.tconstruct.client.block.CastingBasinSpecialRender; -import mods.tinker.tconstruct.client.block.CastingTableSpecialRenderer; -import mods.tinker.tconstruct.client.block.FluidRender; -import mods.tinker.tconstruct.client.block.FrypanRender; -import mods.tinker.tconstruct.client.block.GolemCoreRender; -import mods.tinker.tconstruct.client.block.GolemCoreSpecialRender; -import mods.tinker.tconstruct.client.block.OreberryRender; -import mods.tinker.tconstruct.client.block.SearedRender; -import mods.tinker.tconstruct.client.block.SmallFontRenderer; -import mods.tinker.tconstruct.client.block.SmelteryRender; -import mods.tinker.tconstruct.client.block.TableRender; -import mods.tinker.tconstruct.client.block.TankRender; -import mods.tinker.tconstruct.client.entity.CartRender; -import mods.tinker.tconstruct.client.entity.CloneHeadModel; -import mods.tinker.tconstruct.client.entity.CrystalRender; -import mods.tinker.tconstruct.client.entity.FancyItemRender; -import mods.tinker.tconstruct.client.entity.GolemRender; -import mods.tinker.tconstruct.client.entity.SkylaRender; -import mods.tinker.tconstruct.client.entity.SlimeCloneRender; -import mods.tinker.tconstruct.client.entity.SlimeRender; -import mods.tinker.tconstruct.client.entity.projectile.DaggerRender; -import mods.tinker.tconstruct.client.entity.projectile.LaunchedItemRender; -import mods.tinker.tconstruct.client.gui.ArmorExtendedGui; -import mods.tinker.tconstruct.client.gui.FrypanGui; -import mods.tinker.tconstruct.client.gui.GuiManual; -import mods.tinker.tconstruct.client.gui.PartCrafterGui; -import mods.tinker.tconstruct.client.gui.PatternChestGui; -import mods.tinker.tconstruct.client.gui.PatternShaperGui; -import mods.tinker.tconstruct.client.gui.SmelteryGui; -import mods.tinker.tconstruct.client.gui.ToolStationGui; +import mods.tinker.tconstruct.blocks.logic.*; +import mods.tinker.tconstruct.client.block.*; +import mods.tinker.tconstruct.client.entity.*; +import mods.tinker.tconstruct.client.entity.projectile.*; +import mods.tinker.tconstruct.client.gui.*; import mods.tinker.tconstruct.common.TContent; import mods.tinker.tconstruct.common.TProxyCommon; -import mods.tinker.tconstruct.entity.BlueSlime; -import mods.tinker.tconstruct.entity.CartEntity; -import mods.tinker.tconstruct.entity.Crystal; -import mods.tinker.tconstruct.entity.FancyEntityItem; -import mods.tinker.tconstruct.entity.GolemBase; -import mods.tinker.tconstruct.entity.Skyla; -import mods.tinker.tconstruct.entity.SlimeClone; -import mods.tinker.tconstruct.entity.projectile.DaggerEntity; -import mods.tinker.tconstruct.entity.projectile.LaunchedPotion; +import mods.tinker.tconstruct.entity.*; +import mods.tinker.tconstruct.entity.projectile.*; import mods.tinker.tconstruct.items.tools.Dagger; import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.library.client.TConstructClientRegistry; import mods.tinker.tconstruct.library.client.ToolGuiElement; import mods.tinker.tconstruct.library.crafting.ToolBuilder; import mods.tinker.tconstruct.library.tools.ToolCore; -import mods.tinker.tconstruct.skill.Skill; import mods.tinker.tconstruct.util.player.ArmorExtended; -import mods.tinker.tconstruct.util.player.ArmorExtendedClient; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; @@ -236,6 +193,7 @@ public class TProxyClient extends TProxyCommon RenderingRegistry.registerBlockHandler(new FluidRender()); RenderingRegistry.registerBlockHandler(new GolemCoreRender()); RenderingRegistry.registerBlockHandler(new OreberryRender()); + RenderingRegistry.registerBlockHandler(new BarricadeRender()); //RenderingRegistry.registerBlockHandler(new BrickRender()); //RenderingRegistry.registerBlockHandler(new BallRepeaterRender()); diff --git a/mods/tinker/tconstruct/client/block/BarricadeRender.java b/mods/tinker/tconstruct/client/block/BarricadeRender.java new file mode 100644 index 00000000..b96a155e --- /dev/null +++ b/mods/tinker/tconstruct/client/block/BarricadeRender.java @@ -0,0 +1,1136 @@ +package mods.tinker.tconstruct.client.block; + +import mods.tinker.tconstruct.client.TProxyClient; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.Icon; +import net.minecraft.util.Vec3; +import net.minecraft.world.IBlockAccess; +import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; +import cpw.mods.fml.client.registry.RenderingRegistry; + +public class BarricadeRender implements ISimpleBlockRenderingHandler +{ + public static int model; + + public BarricadeRender() + { + model = RenderingRegistry.getNextAvailableRenderId(); + } + + @Override + public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block barricade, int modelId, RenderBlocks renderer) + { + if (modelId == model) + { + int meta = world.getBlockMetadata(x, y, z); + Tessellator tessellator = Tessellator.instance; + + if ((meta < 4) || (meta == 10) || (meta == 11)) + { + renderInnerEast(renderer, world, x, y, z, (Block)barricade, tessellator); + } + + if (((meta < 4) && (meta > 0)) || (meta == 11)) + { + renderOuterEast(renderer, world, x, y, z, (Block)barricade, tessellator); + } + + if ((meta == 2) || (meta == 3) || ((meta >= 8) && (meta <= 11))) + { + renderInnerWest(renderer, world, x, y, z, (Block)barricade, tessellator); + } + + if ((meta == 3) || ((meta >= 9) && (meta <= 11))) + { + renderOuterWest(renderer, world, x, y, z, (Block)barricade, tessellator); + } + + if (((meta >= 4) && (meta <= 7)) || (meta >= 14)) + { + renderInnerSouth(renderer, world, x, y, z, (Block)barricade, tessellator); + } + + if (((meta >= 5) && (meta <= 7)) || (meta == 15)) + { + renderOuterSouth(renderer, world, x, y, z, (Block)barricade, tessellator); + } + + if ((meta == 6) || (meta == 7) || (meta >= 12)) + { + renderInnerNorth(renderer, world, x, y, z, (Block)barricade, tessellator); + } + + if ((meta == 7) || (meta >= 13)) + { + renderOuterNorth(renderer, world, x, y, z, (Block)barricade, tessellator); + } + + return true; + } + return false; + } + + @Override + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) + { + if (modelID == model) + { + block.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F); + TProxyClient.renderStandardInvBlock(renderer, block, metadata); + block.setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F); + TProxyClient.renderStandardInvBlock(renderer, block, metadata); + } + } + + @Override + public boolean shouldRender3DInInventory() + { + return true; + } + + @Override + public int getRenderId() + { + return model; + } + + private static void renderInnerWest(RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, Block barricade, Tessellator tessellator) + { + tessellator.setBrightness(barricade.getMixedBrightnessForBlock(renderblocks.blockAccess, x, y, z)); + float f3 = 1.0F; + + if (Block.lightValue[barricade.blockID] > 0) + { + f3 = 1.0F; + } + + tessellator.setColorOpaque_F(f3, f3, f3); + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + + if (renderblocks.hasOverrideBlockTexture()) + { + icon = renderblocks.overrideBlockTexture; + } + + double d0 = (double)icon.getMinU(); + double d1 = (double)icon.getMinV(); + double d2 = (double)icon.getMaxU(); + double d3 = (double)icon.getMaxV(); + Vec3[] vec1 = new Vec3[8]; + float minSize = 0.0625F; + float maxSize = 0.0625F; + float height = 0.625F; + vec1[0] = renderblocks.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-minSize), 0.0D, (double)(-maxSize)); + vec1[1] = renderblocks.blockAccess.getWorldVec3Pool().getVecFromPool((double)minSize, 0.0D, (double)(-maxSize)); + vec1[2] = renderblocks.blockAccess.getWorldVec3Pool().getVecFromPool((double)minSize, 0.0D, (double)maxSize); + vec1[3] = renderblocks.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-minSize), 0.0D, (double)maxSize); + vec1[4] = renderblocks.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-minSize), (double)height, (double)(-maxSize)); + vec1[5] = renderblocks.blockAccess.getWorldVec3Pool().getVecFromPool((double)minSize, (double)height, (double)(-maxSize)); + vec1[6] = renderblocks.blockAccess.getWorldVec3Pool().getVecFromPool((double)minSize, (double)height, (double)maxSize); + vec1[7] = renderblocks.blockAccess.getWorldVec3Pool().getVecFromPool((double)(-minSize), (double)height, (double)maxSize); + + + int l = renderblocks.blockAccess.getBlockMetadata(x, y, z); + int i1 = l & 7; + boolean flag = (l & 8) > 0; + + for (int j1 = 0; j1 < 8; ++j1) + { + if (flag) + { + vec1[j1].zCoord -= 0.0625D; + vec1[j1].rotateAroundX(((float)Math.PI * 2F / 9F)); + } + else + { + vec1[j1].zCoord += 0.0625D; + vec1[j1].rotateAroundX(-((float)Math.PI * 2F / 9F)); + } + + if (i1 == 0 || i1 == 7) + { + vec1[j1].rotateAroundZ((float)Math.PI); + } + + if (i1 == 6 || i1 == 0) + { + vec1[j1].rotateAroundY(((float)Math.PI / 2F)); + } + + if (i1 > 0 && i1 < 5) + { + vec1[j1].yCoord -= 0.375D; + vec1[j1].rotateAroundX(((float)Math.PI / 2F)); + + if (i1 == 4) + { + vec1[j1].rotateAroundY(0.0F); + } + + if (i1 == 3) + { + vec1[j1].rotateAroundY((float)Math.PI); + } + + if (i1 == 2) + { + vec1[j1].rotateAroundY(((float)Math.PI / 2F)); + } + + if (i1 == 1) + { + vec1[j1].rotateAroundY(-((float)Math.PI / 2F)); + } + + vec1[j1].xCoord += (double)x + 0.5D; + vec1[j1].yCoord += (double)((float)y + 0.5F); + vec1[j1].zCoord += (double)z + 0.5D; + } + else if (i1 != 0 && i1 != 7) + { + vec1[j1].xCoord += (double)x + 0.5D; + vec1[j1].yCoord += (double)((float)y + 0.125F); + vec1[j1].zCoord += (double)z + 0.5D; + } + else + { + vec1[j1].xCoord += (double)x + 0.5D; + vec1[j1].yCoord += (double)((float)y + 0.875F); + vec1[j1].zCoord += (double)z + 0.5D; + } + } + + Vec3 vec3 = null; + Vec3 vec31 = null; + Vec3 vec32 = null; + Vec3 vec33 = null; + + for (int k1 = 0; k1 < 6; ++k1) + { + if (k1 == 0) + { + d0 = (double)icon.getInterpolatedU(7.0D); + d1 = (double)icon.getInterpolatedV(6.0D); + d2 = (double)icon.getInterpolatedU(9.0D); + d3 = (double)icon.getInterpolatedV(8.0D); + } + else if (k1 == 2) + { + d0 = (double)icon.getInterpolatedU(7.0D); + d1 = (double)icon.getInterpolatedV(6.0D); + d2 = (double)icon.getInterpolatedU(9.0D); + d3 = (double)icon.getMaxV(); + } + + if (k1 == 0) + { + vec3 = vec1[0]; + vec31 = vec1[1]; + vec32 = vec1[2]; + vec33 = vec1[3]; + } + else if (k1 == 1) + { + vec3 = vec1[7]; + vec31 = vec1[6]; + vec32 = vec1[5]; + vec33 = vec1[4]; + } + else if (k1 == 2) + { + vec3 = vec1[1]; + vec31 = vec1[0]; + vec32 = vec1[4]; + vec33 = vec1[5]; + } + else if (k1 == 3) + { + vec3 = vec1[2]; + vec31 = vec1[1]; + vec32 = vec1[5]; + vec33 = vec1[6]; + } + else if (k1 == 4) + { + vec3 = vec1[3]; + vec31 = vec1[2]; + vec32 = vec1[6]; + vec33 = vec1[7]; + } + else if (k1 == 5) + { + vec3 = vec1[0]; + vec31 = vec1[3]; + vec32 = vec1[7]; + vec33 = vec1[4]; + } + + tessellator.addVertexWithUV(vec3.xCoord, vec3.yCoord, vec3.zCoord, d0, d3); + tessellator.addVertexWithUV(vec31.xCoord, vec31.yCoord, vec31.zCoord, d2, d3); + tessellator.addVertexWithUV(vec32.xCoord, vec32.yCoord, vec32.zCoord, d2, d1); + tessellator.addVertexWithUV(vec33.xCoord, vec33.yCoord, vec33.zCoord, d0, d1); + } + + /*tessellator.setBrightness(barricade.getMixedBrightnessForBlock(iblockaccess, x, y, z)); + float color = 1.0F; + + tessellator.setColorOpaque_F(color, color, color); + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + double tex1 = (double)icon.getMinU(); + double tex2 = (double)icon.getMinV(); + double tex3 = (double)icon.getMaxU(); + double tex4 = (double)icon.getMaxV(); + Vec3[] vec1 = new Vec3[8]; + float minSize = 0.125F; + float maxSize = 0.125F; + float height = 1.416F; + vec1[0] = Vec3.createVectorHelper(-minSize, 0.0D, -maxSize); + vec1[1] = Vec3.createVectorHelper(minSize, 0.0D, -maxSize); + vec1[2] = Vec3.createVectorHelper(minSize, 0.0D, maxSize); + vec1[3] = Vec3.createVectorHelper(-minSize, 0.0D, maxSize); + vec1[4] = Vec3.createVectorHelper(-minSize, height, -maxSize); + vec1[5] = Vec3.createVectorHelper(minSize, height, -maxSize); + vec1[6] = Vec3.createVectorHelper(minSize, height, maxSize); + vec1[7] = Vec3.createVectorHelper(-minSize, height, maxSize); + for (int var25 = 0; var25 < 8; var25++) + { + vec1[var25].zCoord -= 0.0625D; + vec1[var25].rotateAroundX(-0.7853982F); + vec1[var25].yCoord -= 0.5D; + vec1[var25].rotateAroundX(1.570796F); + + vec1[var25].xCoord += x + 0.625D; + vec1[var25].yCoord += y; + vec1[var25].zCoord += z + 0.5D; + } + + Vec3 vec1a = null; + Vec3 vec1b = null; + Vec3 vec1c = null; + Vec3 vec1d = null; + + for (int iter = 0; iter < 6; iter++) + { + if (iter == 0) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getInterpolatedV(8.0D); + } + else if (iter == 2) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getMaxV(); + } + + if (iter == 0) + { + vec1a = vec1[0]; + vec1b = vec1[1]; + vec1c = vec1[2]; + vec1d = vec1[3]; + } + else if (iter == 1) + { + vec1a = vec1[7]; + vec1b = vec1[6]; + vec1c = vec1[5]; + vec1d = vec1[4]; + } + else if (iter == 2) + { + vec1a = vec1[1]; + vec1b = vec1[0]; + vec1c = vec1[4]; + vec1d = vec1[5]; + } + else if (iter == 3) + { + vec1a = vec1[2]; + vec1b = vec1[1]; + vec1c = vec1[5]; + vec1d = vec1[6]; + } + else if (iter == 4) + { + vec1a = vec1[3]; + vec1b = vec1[2]; + vec1c = vec1[6]; + vec1d = vec1[7]; + } + else if (iter == 5) + { + vec1a = vec1[0]; + vec1b = vec1[3]; + vec1c = vec1[7]; + vec1d = vec1[4]; + } + + tessellator.addVertexWithUV(vec1a.xCoord, vec1a.yCoord, vec1a.zCoord, tex1, tex4); + tessellator.addVertexWithUV(vec1b.xCoord, vec1b.yCoord, vec1b.zCoord, tex2, tex4); + tessellator.addVertexWithUV(vec1c.xCoord, vec1c.yCoord, vec1c.zCoord, tex2, tex3); + tessellator.addVertexWithUV(vec1d.xCoord, vec1d.yCoord, vec1d.zCoord, tex1, tex3); + }*/ + } + + private static void renderOuterWest(RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, Block barricade, Tessellator tessellator) + { + tessellator.setBrightness(barricade.getMixedBrightnessForBlock(iblockaccess, x, y, z)); + float color = 1.0F; + + tessellator.setColorOpaque_F(color, color, color); + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + double tex1 = (double)icon.getMinU(); + double tex2 = (double)icon.getMinV(); + double tex3 = (double)icon.getMaxU(); + double tex4 = (double)icon.getMaxV(); + Vec3[] vec2 = new Vec3[8]; + float minSize = 0.125F; + float maxSize = 0.125F; + float height = 1.416F; + + vec2[0] = Vec3.createVectorHelper(-minSize, 0.0D, -maxSize); + vec2[1] = Vec3.createVectorHelper(minSize, 0.0D, -maxSize); + vec2[2] = Vec3.createVectorHelper(minSize, 0.0D, maxSize); + vec2[3] = Vec3.createVectorHelper(-minSize, 0.0D, maxSize); + vec2[4] = Vec3.createVectorHelper(-minSize, height, -maxSize); + vec2[5] = Vec3.createVectorHelper(minSize, height, -maxSize); + vec2[6] = Vec3.createVectorHelper(minSize, height, maxSize); + vec2[7] = Vec3.createVectorHelper(-minSize, height, maxSize); + + for (int var25 = 0; var25 < 8; var25++) + { + vec2[var25].zCoord -= 0.0625D; + vec2[var25].rotateAroundX(-0.7853982F); + vec2[var25].yCoord -= 0.5D; + vec2[var25].rotateAroundX(1.570796F); + + vec2[var25].xCoord += x + 0.125D; + vec2[var25].yCoord += y; + vec2[var25].zCoord += z + 0.5D; + } + Vec3 vec2a = null; + Vec3 vec2b = null; + Vec3 vec2c = null; + Vec3 vec2d = null; + + for (int iter = 0; iter < 6; iter++) + { + if (iter == 0) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getInterpolatedV(8.0D); + } + else if (iter == 2) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getMaxV(); + } + + if (iter == 0) + { + vec2a = vec2[0]; + vec2b = vec2[1]; + vec2c = vec2[2]; + vec2d = vec2[3]; + } + else if (iter == 1) + { + vec2a = vec2[7]; + vec2b = vec2[6]; + vec2c = vec2[5]; + vec2d = vec2[4]; + } + else if (iter == 2) + { + vec2a = vec2[1]; + vec2b = vec2[0]; + vec2c = vec2[4]; + vec2d = vec2[5]; + } + else if (iter == 3) + { + vec2a = vec2[2]; + vec2b = vec2[1]; + vec2c = vec2[5]; + vec2d = vec2[6]; + } + else if (iter == 4) + { + vec2a = vec2[3]; + vec2b = vec2[2]; + vec2c = vec2[6]; + vec2d = vec2[7]; + } + else if (iter == 5) + { + vec2a = vec2[0]; + vec2b = vec2[3]; + vec2c = vec2[7]; + vec2d = vec2[4]; + } + + tessellator.addVertexWithUV(vec2a.xCoord, vec2a.yCoord, vec2a.zCoord, tex1, tex4); + tessellator.addVertexWithUV(vec2b.xCoord, vec2b.yCoord, vec2b.zCoord, tex2, tex4); + tessellator.addVertexWithUV(vec2c.xCoord, vec2c.yCoord, vec2c.zCoord, tex2, tex3); + tessellator.addVertexWithUV(vec2d.xCoord, vec2d.yCoord, vec2d.zCoord, tex1, tex3); + } + } + + private static void renderInnerEast(RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, Block barricade, Tessellator tessellator) + { + tessellator.setBrightness(barricade.getMixedBrightnessForBlock(iblockaccess, x, y, z)); + float color = 1.0F; + + tessellator.setColorOpaque_F(color, color, color); + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + double tex1 = (double)icon.getMinU(); + double tex2 = (double)icon.getMinV(); + double tex3 = (double)icon.getMaxU(); + double tex4 = (double)icon.getMaxV(); + Vec3[] vec3 = new Vec3[8]; + float minSize = 0.125F; + float maxSize = 0.125F; + float height = 1.416F; + vec3[0] = Vec3.createVectorHelper(-minSize, 0.0D, -maxSize); + vec3[1] = Vec3.createVectorHelper(minSize, 0.0D, -maxSize); + vec3[2] = Vec3.createVectorHelper(minSize, 0.0D, maxSize); + vec3[3] = Vec3.createVectorHelper(-minSize, 0.0D, maxSize); + vec3[4] = Vec3.createVectorHelper(-minSize, height, -maxSize); + vec3[5] = Vec3.createVectorHelper(minSize, height, -maxSize); + vec3[6] = Vec3.createVectorHelper(minSize, height, maxSize); + vec3[7] = Vec3.createVectorHelper(-minSize, height, maxSize); + + for (int var25 = 0; var25 < 8; var25++) + { + vec3[var25].zCoord -= 0.0625D; + vec3[var25].rotateAroundX(-0.7853982F); + vec3[var25].yCoord -= 0.0625D; + vec3[var25].rotateAroundX(6.283186F); + + vec3[var25].xCoord += x + 0.375D; + vec3[var25].yCoord += y; + vec3[var25].zCoord += z; + } + + Vec3 vec3a = null; + Vec3 vec3b = null; + Vec3 vec3c = null; + Vec3 Vec3 = null; + + for (int iter = 0; iter < 6; iter++) + { + if (iter == 0) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getInterpolatedV(8.0D); + } + else if (iter == 2) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getMaxV(); + } + + if (iter == 0) + { + vec3a = vec3[0]; + vec3b = vec3[1]; + vec3c = vec3[2]; + Vec3 = vec3[3]; + } + else if (iter == 1) + { + vec3a = vec3[7]; + vec3b = vec3[6]; + vec3c = vec3[5]; + Vec3 = vec3[4]; + } + else if (iter == 2) + { + vec3a = vec3[1]; + vec3b = vec3[0]; + vec3c = vec3[4]; + Vec3 = vec3[5]; + } + else if (iter == 3) + { + vec3a = vec3[2]; + vec3b = vec3[1]; + vec3c = vec3[5]; + Vec3 = vec3[6]; + } + else if (iter == 4) + { + vec3a = vec3[2]; + vec3b = vec3[1]; + vec3c = vec3[5]; + Vec3 = vec3[6]; + } + else if (iter == 5) + { + vec3a = vec3[0]; + vec3b = vec3[3]; + vec3c = vec3[7]; + Vec3 = vec3[4]; + } + + tessellator.addVertexWithUV(vec3a.xCoord, vec3a.yCoord, vec3a.zCoord, tex1, tex4); + tessellator.addVertexWithUV(vec3b.xCoord, vec3b.yCoord, vec3b.zCoord, tex2, tex4); + tessellator.addVertexWithUV(vec3c.xCoord, vec3c.yCoord, vec3c.zCoord, tex2, tex3); + tessellator.addVertexWithUV(Vec3.xCoord, Vec3.yCoord, Vec3.zCoord, tex1, tex3); + } + } + + private static void renderOuterEast(RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, Block barricade, Tessellator tessellator) + { + tessellator.setBrightness(barricade.getMixedBrightnessForBlock(iblockaccess, x, y, z)); + float color = 1.0F; + + tessellator.setColorOpaque_F(color, color, color); + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + double tex1 = (double)icon.getMinU(); + double tex2 = (double)icon.getMinV(); + double tex3 = (double)icon.getMaxU(); + double tex4 = (double)icon.getMaxV(); + Vec3[] vec4 = new Vec3[8]; + float minSize = 0.125F; + float maxSize = 0.125F; + float height = 1.416F; + + vec4[0] = Vec3.createVectorHelper(-minSize, 0.0D, -maxSize); + vec4[1] = Vec3.createVectorHelper(minSize, 0.0D, -maxSize); + vec4[2] = Vec3.createVectorHelper(minSize, 0.0D, maxSize); + vec4[3] = Vec3.createVectorHelper(-minSize, 0.0D, maxSize); + vec4[4] = Vec3.createVectorHelper(-minSize, height, -maxSize); + vec4[5] = Vec3.createVectorHelper(minSize, height, -maxSize); + vec4[6] = Vec3.createVectorHelper(minSize, height, maxSize); + vec4[7] = Vec3.createVectorHelper(-minSize, height, maxSize); + + for (int var25 = 0; var25 < 8; var25++) + { + vec4[var25].zCoord -= 0.0625D; + vec4[var25].rotateAroundX(-0.7853982F); + vec4[var25].yCoord -= 0.0625D; + vec4[var25].rotateAroundX(6.283186F); + + vec4[var25].xCoord += x + 0.875D; + vec4[var25].yCoord += y; + vec4[var25].zCoord += z; + } + + Vec3 vec4a = null; + Vec3 vec4b = null; + Vec3 vec4c = null; + Vec3 vec4d = null; + + for (int iter = 0; iter < 6; iter++) + { + if (iter == 0) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getInterpolatedV(8.0D); + } + else if (iter == 2) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getMaxV(); + } + + if (iter == 0) + { + vec4a = vec4[0]; + vec4b = vec4[1]; + vec4c = vec4[2]; + vec4d = vec4[3]; + } + else if (iter == 1) + { + vec4a = vec4[7]; + vec4b = vec4[6]; + vec4c = vec4[5]; + vec4d = vec4[4]; + } + else if (iter == 2) + { + vec4a = vec4[1]; + vec4b = vec4[0]; + vec4c = vec4[4]; + vec4d = vec4[5]; + } + else if (iter == 3) + { + vec4a = vec4[2]; + vec4b = vec4[1]; + vec4c = vec4[5]; + vec4d = vec4[6]; + } + else if (iter == 4) + { + vec4a = vec4[2]; + vec4b = vec4[1]; + vec4c = vec4[5]; + vec4d = vec4[6]; + } + else if (iter == 5) + { + vec4a = vec4[0]; + vec4b = vec4[3]; + vec4c = vec4[7]; + vec4d = vec4[4]; + } + + tessellator.addVertexWithUV(vec4a.xCoord, vec4a.yCoord, vec4a.zCoord, tex1, tex4); + tessellator.addVertexWithUV(vec4b.xCoord, vec4b.yCoord, vec4b.zCoord, tex2, tex4); + tessellator.addVertexWithUV(vec4c.xCoord, vec4c.yCoord, vec4c.zCoord, tex2, tex3); + tessellator.addVertexWithUV(vec4d.xCoord, vec4d.yCoord, vec4d.zCoord, tex1, tex3); + } + } + + private static void renderInnerNorth(RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, Block barricade, Tessellator tessellator) + { + tessellator.setBrightness(barricade.getMixedBrightnessForBlock(iblockaccess, x, y, z)); + float color = 1.0F; + + tessellator.setColorOpaque_F(color, color, color); + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + double tex1 = (double)icon.getMinU(); + double tex2 = (double)icon.getMinV(); + double tex3 = (double)icon.getMaxU(); + double tex4 = (double)icon.getMaxV(); + Vec3[] vec1 = new Vec3[8]; + float minSize = 0.125F; + float maxSize = 0.125F; + float height = 1.416F; + vec1[0] = Vec3.createVectorHelper(-minSize, 0.0D, -maxSize); + vec1[1] = Vec3.createVectorHelper(minSize, 0.0D, -maxSize); + vec1[2] = Vec3.createVectorHelper(minSize, 0.0D, maxSize); + vec1[3] = Vec3.createVectorHelper(-minSize, 0.0D, maxSize); + vec1[4] = Vec3.createVectorHelper(-minSize, height, -maxSize); + vec1[5] = Vec3.createVectorHelper(minSize, height, -maxSize); + vec1[6] = Vec3.createVectorHelper(minSize, height, maxSize); + vec1[7] = Vec3.createVectorHelper(-minSize, height, maxSize); + + for (int var25 = 0; var25 < 8; var25++) + { + vec1[var25].zCoord -= 0.4375D; + vec1[var25].rotateAroundX(-0.7853982F); + vec1[var25].yCoord -= 0.5D; + vec1[var25].rotateAroundY(1.570796F); + + vec1[var25].xCoord += x + 0.375D; + vec1[var25].yCoord += y + 0.1875D; + vec1[var25].zCoord += z + 0.625D; + } + + Vec3 vec1a = null; + Vec3 vec1b = null; + Vec3 vec1c = null; + Vec3 vec1d = null; + + for (int iter = 0; iter < 6; iter++) + { + if (iter == 0) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getInterpolatedV(8.0D); + } + else if (iter == 2) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getMaxV(); + } + + if (iter == 0) + { + vec1a = vec1[0]; + vec1b = vec1[1]; + vec1c = vec1[2]; + vec1d = vec1[3]; + } + else if (iter == 1) + { + vec1a = vec1[7]; + vec1b = vec1[6]; + vec1c = vec1[5]; + vec1d = vec1[4]; + } + else if (iter == 2) + { + vec1a = vec1[1]; + vec1b = vec1[0]; + vec1c = vec1[4]; + vec1d = vec1[5]; + } + else if (iter == 3) + { + vec1a = vec1[2]; + vec1b = vec1[1]; + vec1c = vec1[5]; + vec1d = vec1[6]; + } + else if (iter == 4) + { + vec1a = vec1[3]; + vec1b = vec1[2]; + vec1c = vec1[6]; + vec1d = vec1[7]; + } + else if (iter == 5) + { + vec1a = vec1[0]; + vec1b = vec1[3]; + vec1c = vec1[7]; + vec1d = vec1[4]; + } + + tessellator.addVertexWithUV(vec1a.xCoord, vec1a.yCoord, vec1a.zCoord, tex1, tex4); + tessellator.addVertexWithUV(vec1b.xCoord, vec1b.yCoord, vec1b.zCoord, tex2, tex4); + tessellator.addVertexWithUV(vec1c.xCoord, vec1c.yCoord, vec1c.zCoord, tex2, tex3); + tessellator.addVertexWithUV(vec1d.xCoord, vec1d.yCoord, vec1d.zCoord, tex1, tex3); + } + } + + private static void renderOuterNorth(RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, Block barricade, Tessellator tessellator) + { + tessellator.setBrightness(barricade.getMixedBrightnessForBlock(iblockaccess, x, y, z)); + float color = 1.0F; + + tessellator.setColorOpaque_F(color, color, color); + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + double tex1 = (double)icon.getMinU(); + double tex2 = (double)icon.getMinV(); + double tex3 = (double)icon.getMaxU(); + double tex4 = (double)icon.getMaxV(); + Vec3[] vec2 = new Vec3[8]; + float minSize = 0.125F; + float maxSize = 0.125F; + float height = 1.416F; + vec2[0] = Vec3.createVectorHelper(-minSize, 0.0D, -maxSize); + vec2[1] = Vec3.createVectorHelper(minSize, 0.0D, -maxSize); + vec2[2] = Vec3.createVectorHelper(minSize, 0.0D, maxSize); + vec2[3] = Vec3.createVectorHelper(-minSize, 0.0D, maxSize); + vec2[4] = Vec3.createVectorHelper(-minSize, height, -maxSize); + vec2[5] = Vec3.createVectorHelper(minSize, height, -maxSize); + vec2[6] = Vec3.createVectorHelper(minSize, height, maxSize); + vec2[7] = Vec3.createVectorHelper(-minSize, height, maxSize); + + for (int var25 = 0; var25 < 8; var25++) + { + vec2[var25].zCoord -= 0.4375D; + vec2[var25].rotateAroundX(-0.7853982F); + vec2[var25].yCoord -= 0.5D; + vec2[var25].rotateAroundY(1.570796F); + + vec2[var25].xCoord += x + 0.375D; + vec2[var25].yCoord += y + 0.1875D; + vec2[var25].zCoord += z + 0.125D; + } + + Vec3 vec2a = null; + Vec3 vec2b = null; + Vec3 vec2c = null; + Vec3 vec2d = null; + + for (int iter = 0; iter < 6; iter++) + { + if (iter == 0) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getInterpolatedV(8.0D); + } + else if (iter == 2) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getMaxV(); + } + + if (iter == 0) + { + vec2a = vec2[0]; + vec2b = vec2[1]; + vec2c = vec2[2]; + vec2d = vec2[3]; + } + else if (iter == 1) + { + vec2a = vec2[7]; + vec2b = vec2[6]; + vec2c = vec2[5]; + vec2d = vec2[4]; + } + else if (iter == 2) + { + vec2a = vec2[1]; + vec2b = vec2[0]; + vec2c = vec2[4]; + vec2d = vec2[5]; + } + else if (iter == 3) + { + vec2a = vec2[2]; + vec2b = vec2[1]; + vec2c = vec2[5]; + vec2d = vec2[6]; + } + else if (iter == 4) + { + vec2a = vec2[3]; + vec2b = vec2[2]; + vec2c = vec2[6]; + vec2d = vec2[7]; + } + else if (iter == 5) + { + vec2a = vec2[0]; + vec2b = vec2[3]; + vec2c = vec2[7]; + vec2d = vec2[4]; + } + + tessellator.addVertexWithUV(vec2a.xCoord, vec2a.yCoord, vec2a.zCoord, tex1, tex4); + tessellator.addVertexWithUV(vec2b.xCoord, vec2b.yCoord, vec2b.zCoord, tex2, tex4); + tessellator.addVertexWithUV(vec2c.xCoord, vec2c.yCoord, vec2c.zCoord, tex2, tex3); + tessellator.addVertexWithUV(vec2d.xCoord, vec2d.yCoord, vec2d.zCoord, tex1, tex3); + } + } + + private static void renderInnerSouth(RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, Block barricade, Tessellator tessellator) + { + tessellator.setBrightness(barricade.getMixedBrightnessForBlock(iblockaccess, x, y, z)); + float color = 1.0F; + + tessellator.setColorOpaque_F(color, color, color); + + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + double tex1 = (double)icon.getMinU(); + double tex2 = (double)icon.getMinV(); + double tex3 = (double)icon.getMaxU(); + double tex4 = (double)icon.getMaxV(); + Vec3[] vec3 = new Vec3[8]; + float minSize = 0.125F; + float maxSize = 0.125F; + float height = 1.416F; + vec3[0] = Vec3.createVectorHelper(-minSize, 0.0D, -maxSize); + vec3[1] = Vec3.createVectorHelper(minSize, 0.0D, -maxSize); + vec3[2] = Vec3.createVectorHelper(minSize, 0.0D, maxSize); + vec3[3] = Vec3.createVectorHelper(-minSize, 0.0D, maxSize); + vec3[4] = Vec3.createVectorHelper(-minSize, height, -maxSize); + vec3[5] = Vec3.createVectorHelper(minSize, height, -maxSize); + vec3[6] = Vec3.createVectorHelper(minSize, height, maxSize); + vec3[7] = Vec3.createVectorHelper(-minSize, height, maxSize); + + for (int var25 = 0; var25 < 8; var25++) + { + vec3[var25].zCoord -= 0.4375D; + vec3[var25].rotateAroundX(-0.7853982F); + vec3[var25].yCoord -= 0.5D; + vec3[var25].rotateAroundY(4.712389F); + + vec3[var25].xCoord += x + 0.625D; + vec3[var25].yCoord += y + 0.1875D; + vec3[var25].zCoord += z + 0.375D; + } + Vec3 vec3a = null; + Vec3 vec3b = null; + Vec3 vec3c = null; + Vec3 Vec3 = null; + for (int iter = 0; iter < 6; iter++) + { + if (iter == 0) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getInterpolatedV(8.0D); + } + else if (iter == 2) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getMaxV(); + } + + if (iter == 0) + { + vec3a = vec3[0]; + vec3b = vec3[1]; + vec3c = vec3[2]; + Vec3 = vec3[3]; + } + else if (iter == 1) + { + vec3a = vec3[7]; + vec3b = vec3[6]; + vec3c = vec3[5]; + Vec3 = vec3[4]; + } + else if (iter == 2) + { + vec3a = vec3[1]; + vec3b = vec3[0]; + vec3c = vec3[4]; + Vec3 = vec3[5]; + } + else if (iter == 3) + { + vec3a = vec3[2]; + vec3b = vec3[1]; + vec3c = vec3[5]; + Vec3 = vec3[6]; + } + else if (iter == 4) + { + vec3a = vec3[2]; + vec3b = vec3[1]; + vec3c = vec3[5]; + Vec3 = vec3[6]; + } + else if (iter == 5) + { + vec3a = vec3[0]; + vec3b = vec3[3]; + vec3c = vec3[7]; + Vec3 = vec3[4]; + } + + tessellator.addVertexWithUV(vec3a.xCoord, vec3a.yCoord, vec3a.zCoord, tex1, tex4); + tessellator.addVertexWithUV(vec3b.xCoord, vec3b.yCoord, vec3b.zCoord, tex2, tex4); + tessellator.addVertexWithUV(vec3c.xCoord, vec3c.yCoord, vec3c.zCoord, tex2, tex3); + tessellator.addVertexWithUV(Vec3.xCoord, Vec3.yCoord, Vec3.zCoord, tex1, tex3); + } + } + + private static void renderOuterSouth(RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, Block barricade, Tessellator tessellator) + { + tessellator.setBrightness(barricade.getMixedBrightnessForBlock(iblockaccess, x, y, z)); + float color = 1.0F; + + tessellator.setColorOpaque_F(color, color, color); + Icon icon = renderblocks.getBlockIconFromSide(barricade, 0); + double tex1 = (double)icon.getMinU(); + double tex2 = (double)icon.getMinV(); + double tex3 = (double)icon.getMaxU(); + double tex4 = (double)icon.getMaxV(); + Vec3[] vec4 = new Vec3[8]; + float minSize = 0.125F; + float maxSize = 0.125F; + float height = 1.416F; + vec4[0] = Vec3.createVectorHelper(-minSize, 0.0D, -maxSize); + vec4[1] = Vec3.createVectorHelper(minSize, 0.0D, -maxSize); + vec4[2] = Vec3.createVectorHelper(minSize, 0.0D, maxSize); + vec4[3] = Vec3.createVectorHelper(-minSize, 0.0D, maxSize); + vec4[4] = Vec3.createVectorHelper(-minSize, height, -maxSize); + vec4[5] = Vec3.createVectorHelper(minSize, height, -maxSize); + vec4[6] = Vec3.createVectorHelper(minSize, height, maxSize); + vec4[7] = Vec3.createVectorHelper(-minSize, height, maxSize); + + for (int var25 = 0; var25 < 8; var25++) + { + vec4[var25].zCoord -= 0.4375D; + vec4[var25].rotateAroundX(-0.7853982F); + vec4[var25].yCoord -= 0.5D; + vec4[var25].rotateAroundY(4.712389F); + + vec4[var25].xCoord += x + 0.625D; + vec4[var25].yCoord += y + 0.1875D; + vec4[var25].zCoord += z + 0.875D; + } + + Vec3 vec4a = null; + Vec3 vec4b = null; + Vec3 vec4c = null; + Vec3 vec4d = null; + + for (int iter = 0; iter < 6; iter++) + { + if (iter == 0) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getInterpolatedV(8.0D); + } + else if (iter == 2) + { + tex1 = (double)icon.getInterpolatedU(7.0D); + tex2 = (double)icon.getInterpolatedV(6.0D); + tex3 = (double)icon.getInterpolatedU(9.0D); + tex4 = (double)icon.getMaxV(); + } + + if (iter == 0) + { + vec4a = vec4[0]; + vec4b = vec4[1]; + vec4c = vec4[2]; + vec4d = vec4[3]; + } + else if (iter == 1) + { + vec4a = vec4[7]; + vec4b = vec4[6]; + vec4c = vec4[5]; + vec4d = vec4[4]; + } + else if (iter == 2) + { + vec4a = vec4[1]; + vec4b = vec4[0]; + vec4c = vec4[4]; + vec4d = vec4[5]; + } + else if (iter == 3) + { + vec4a = vec4[2]; + vec4b = vec4[1]; + vec4c = vec4[5]; + vec4d = vec4[6]; + } + else if (iter == 4) + { + vec4a = vec4[2]; + vec4b = vec4[1]; + vec4c = vec4[5]; + vec4d = vec4[6]; + } + else if (iter == 5) + { + vec4a = vec4[0]; + vec4b = vec4[3]; + vec4c = vec4[7]; + vec4d = vec4[4]; + } + + tessellator.addVertexWithUV(vec4a.xCoord, vec4a.yCoord, vec4a.zCoord, tex1, tex4); + tessellator.addVertexWithUV(vec4b.xCoord, vec4b.yCoord, vec4b.zCoord, tex2, tex4); + tessellator.addVertexWithUV(vec4c.xCoord, vec4c.yCoord, vec4c.zCoord, tex2, tex3); + tessellator.addVertexWithUV(vec4d.xCoord, vec4d.yCoord, vec4d.zCoord, tex1, tex3); + } + } +} diff --git a/mods/tinker/tconstruct/common/TContent.java b/mods/tinker/tconstruct/common/TContent.java index 96102f33..6ceea2f3 100644 --- a/mods/tinker/tconstruct/common/TContent.java +++ b/mods/tinker/tconstruct/common/TContent.java @@ -31,6 +31,8 @@ import mods.tinker.tconstruct.blocks.logic.PatternShaperLogic; import mods.tinker.tconstruct.blocks.logic.SmelteryDrainLogic; import mods.tinker.tconstruct.blocks.logic.SmelteryLogic; import mods.tinker.tconstruct.blocks.logic.ToolStationLogic; +import mods.tinker.tconstruct.blocks.traps.BarricadeBlock; +import mods.tinker.tconstruct.blocks.traps.Landmine; import mods.tinker.tconstruct.entity.BlueSlime; import mods.tinker.tconstruct.entity.FancyEntityItem; import mods.tinker.tconstruct.entity.projectile.DaggerEntity; @@ -98,6 +100,7 @@ import mods.tinker.tconstruct.modifiers.TActiveOmniMod; import mods.tinker.tconstruct.util.PHConstruct; import mods.tinker.tconstruct.util.RecipeRemover; import net.minecraft.block.Block; +import net.minecraft.block.EnumMobType; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialLiquid; @@ -196,6 +199,7 @@ public class TContent implements IFuelHandler //Traps public static Block landmine; + public static Block barricade; //InfiBlocks public static Block speedBlock; @@ -428,6 +432,12 @@ public class TContent implements IFuelHandler /*golemPedestal = new GolemPedestalBlock(PHConstruct.golemPedestal).setUnlocalizedName("golempedestal"); GameRegistry.registerBlock(golemPedestal, "Golem Pedestal"); GameRegistry.registerTileEntity(GolemPedestalLogic.class, "TConstruct.GolemPedestal");*/ + + //Traps + /*landmine = new Landmine(PHConstruct.landmine, EnumMobType.mobs, Material.wood).setUnlocalizedName("tconstruct.landmine"); + GameRegistry.registerBlock(landmine, "Landmine"); + barricade = new BarricadeBlock(PHConstruct.barricade).setUnlocalizedName("tconstruct.barricade"); + GameRegistry.registerBlock(barricade, "Barricade");*/ } void registerItems () @@ -824,7 +834,7 @@ public class TContent implements IFuelHandler GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolStationWood, 1, 1), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "logWood")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolStationWood, 1, 10), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "plankWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', Item.stick)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', "stickWood")); GameRegistry.addRecipe(new ItemStack(manualBook), "wp", 'w', new ItemStack(blankPattern, 1, 0), 'p', Item.paper); GameRegistry.addShapelessRecipe(new ItemStack(manualBook, 2, 0), new ItemStack(manualBook, 1, 0), Item.book); GameRegistry.addShapelessRecipe(new ItemStack(manualBook, 1, 1), new ItemStack(manualBook, 1, 0)); @@ -911,7 +921,8 @@ public class TContent implements IFuelHandler GameRegistry.addRecipe(new ItemStack(searedBlock, 1, 0), "bbb", "b b", "b b", 'b', searedBrick); //Table GameRegistry.addRecipe(new ItemStack(searedBlock, 1, 1), "b b", " b ", 'b', searedBrick); //Faucet GameRegistry.addRecipe(new ItemStack(searedBlock, 1, 2), "b b", "b b", "bbb", 'b', searedBrick); //Basin - + + GameRegistry.addRecipe(new ItemStack(Block.pumpkinLantern, 1, 0), "p", "s", 'p', new ItemStack(Block.pumpkin), 'w', new ItemStack(toolRod, 1, 1)); GameRegistry.addRecipe(new ItemStack(stoneTorch, 4), "p", "w", 'p', new ItemStack(Item.coal, 1, Short.MAX_VALUE), 'w', new ItemStack(toolRod, 1, 1)); GameRegistry.addRecipe(new ItemStack(toolRod, 4, 1), "c", "c", 'c', new ItemStack(Block.stone)); GameRegistry.addRecipe(new ItemStack(toolRod, 2, 1), "c", "c", 'c', new ItemStack(Block.cobblestone)); diff --git a/mods/tinker/tconstruct/entity/BlueSlime.java b/mods/tinker/tconstruct/entity/BlueSlime.java index 1a8f68c6..40a69cd4 100644 --- a/mods/tinker/tconstruct/entity/BlueSlime.java +++ b/mods/tinker/tconstruct/entity/BlueSlime.java @@ -5,6 +5,7 @@ import mods.tinker.tconstruct.common.TContent; import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.library.crafting.ToolBuilder; import mods.tinker.tconstruct.library.tools.ToolCore; +import net.minecraft.block.material.Material; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.boss.IBossDisplayData; @@ -368,6 +369,11 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData } } } + + public boolean handleWaterMovement() + { + return false; + } protected void func_70808_l () { @@ -443,7 +449,7 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData tags.setInteger("MiningSpeed", 800); this.entityDropItem(toolStack, 0f); - if (rand.nextInt(10) == 0) + if (rand.nextInt(5) == 0) { ItemStack dropStack = new ItemStack(TContent.heartCanister, 1, 1); this.entityDropItem(dropStack, 0f); diff --git a/mods/tinker/tconstruct/library/SkillRegistry.java b/mods/tinker/tconstruct/library/SkillRegistry.java index 064164a3..8b809785 100644 --- a/mods/tinker/tconstruct/library/SkillRegistry.java +++ b/mods/tinker/tconstruct/library/SkillRegistry.java @@ -9,15 +9,15 @@ public class SkillRegistry public static HashMap skills = new HashMap(); static int skillID = 0; - public static HashMap skillMapping = new HashMap(); //Simplifies network transmission + public static HashMap skillMapping = new HashMap(); //Simplifies network transmission public static void registerSkill(String name, Skill skill) { skills.put(name, skill); - skillMapping.put(getNextID(), name); + skillMapping.put(getNextAvailableID(), skill); } - static Integer getNextID () + static Integer getNextAvailableID () { return skillID++; } diff --git a/mods/tinker/tconstruct/library/tools/AbilityHelper.java b/mods/tinker/tconstruct/library/tools/AbilityHelper.java index ca1abd50..9f30b090 100644 --- a/mods/tinker/tconstruct/library/tools/AbilityHelper.java +++ b/mods/tinker/tconstruct/library/tools/AbilityHelper.java @@ -74,7 +74,7 @@ public class AbilityHelper int durability = tags.getCompoundTag("InfiTool").getInteger("Damage"); float stonebound = tags.getCompoundTag("InfiTool").getFloat("Shoddy"); - float stoneboundDamage = -stonebound * durability / 100f; + float stoneboundDamage = -stonebound * durability / 50f; int earlyModDamage = 0; for (ActiveToolMod mod : TConstructRegistry.activeModifiers) @@ -103,6 +103,8 @@ public class AbilityHelper } damage += stoneboundDamage; + if (damage < 1) + damage = 1; if (player.isSprinting()) { @@ -338,6 +340,10 @@ public class AbilityHelper int mineSpeed = tags.getCompoundTag("InfiTool").getInteger("MiningSpeed"); if (tags.getCompoundTag("InfiTool").hasKey("MiningSpeed2")) mineSpeed = (mineSpeed + tags.getCompoundTag("InfiTool").getInteger("MiningSpeed2")) / 2; + + int durability = tags.getInteger("Damage"); + float shoddy = tags.getFloat("Shoddy"); + mineSpeed += shoddy * durability / 100f; mineSpeed /= 15; if (charge < mineSpeed) diff --git a/mods/tinker/tconstruct/library/tools/ToolCore.java b/mods/tinker/tconstruct/library/tools/ToolCore.java index e3ef8c86..0b2e9fff 100644 --- a/mods/tinker/tconstruct/library/tools/ToolCore.java +++ b/mods/tinker/tconstruct/library/tools/ToolCore.java @@ -776,5 +776,77 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox { return true; } + + /* Proper stack damage */ + public int getItemDamageFromStack(ItemStack stack) + { + NBTTagCompound tags = stack.getTagCompound(); + if (tags == null) + { + /*System.out.println("Tool item is uninitalized! This method should never be called with a default item"); + Exception e = new NullPointerException(); + e.printStackTrace();*/ + return 0; + } + + if (tags.hasKey("charge")) + { + int charge = tags.getInteger("charge"); + if (charge > 0) + return charge; + } + return tags.getCompoundTag("InfiTool").getInteger("Damage"); + } + + /** + * Return the itemDamage display value represented by this itemstack. + * @param stack the stack + * @return the damage value + */ + public int getItemDamageFromStackForDisplay(ItemStack stack) + { + NBTTagCompound tags = stack.getTagCompound(); + if (tags == null) + { + /*System.out.println("Tool item is uninitalized! This method should never be called with a default item"); + Exception e = new NullPointerException(); + e.printStackTrace();*/ + return 0; + } + + if (tags.hasKey("charge")) + { + int charge = tags.getInteger("charge"); + if (charge > 0) + return charge; + } + return tags.getCompoundTag("InfiTool").getInteger("Damage"); + } + + /** + * Return the maxDamage for this ItemStack. Defaults to the maxDamage field in this item, but can be overridden here for other sources such as NBT. + * + * @param stack The itemstack that is damaged + * @return the damage value + */ + public int getItemMaxDamageFromStack(ItemStack stack) + { + NBTTagCompound tags = stack.getTagCompound(); + if (tags == null) + { + /*System.out.println("Tool item is uninitalized! This method should never be called with a default item"); + Exception e = new NullPointerException(); + e.printStackTrace();*/ + return 0; + } + + if (tags.hasKey("charge")) + { + int charge = tags.getInteger("charge"); + if (charge > 0) + return this.getMaxCharge(stack); + } + return tags.getCompoundTag("InfiTool").getInteger("TotalDurability"); + } } diff --git a/mods/tinker/tconstruct/modifiers/TActiveOmniMod.java b/mods/tinker/tconstruct/modifiers/TActiveOmniMod.java index c4a5a249..f703b258 100644 --- a/mods/tinker/tconstruct/modifiers/TActiveOmniMod.java +++ b/mods/tinker/tconstruct/modifiers/TActiveOmniMod.java @@ -31,7 +31,7 @@ public class TActiveOmniMod extends ActiveToolMod @Override public void updateTool (ToolCore tool, ItemStack stack, World world, Entity entity) { - if (!world.isRemote && entity instanceof EntityLiving && !((EntityLiving) entity).isSwingInProgress) + if (!world.isRemote && entity instanceof EntityLiving && !((EntityLiving) entity).isSwingInProgress && stack.getTagCompound() != null) { NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool"); if (tags.hasKey("Moss")) diff --git a/mods/tinker/tconstruct/skill/Jump.java b/mods/tinker/tconstruct/skill/Jump.java index de1efc9f..7ee2a684 100644 --- a/mods/tinker/tconstruct/skill/Jump.java +++ b/mods/tinker/tconstruct/skill/Jump.java @@ -6,7 +6,6 @@ import net.minecraft.world.World; public class Jump extends Skill { - @Override public String getTextureFile (int guiscale) { diff --git a/mods/tinker/tconstruct/skill/Skill.java b/mods/tinker/tconstruct/skill/Skill.java index 9efe11ef..604484a3 100644 --- a/mods/tinker/tconstruct/skill/Skill.java +++ b/mods/tinker/tconstruct/skill/Skill.java @@ -12,7 +12,8 @@ import net.minecraft.world.World; */ public abstract class Skill -{ +{ + public int skillID; boolean active = true; public abstract String getTextureFile(int guiscale); public abstract String getSkillName(); @@ -34,6 +35,11 @@ public abstract class Skill return 0; } + public void setActive(boolean flag) + { + this.active = flag; + } + public boolean getActive() { return active; @@ -41,9 +47,21 @@ public abstract class Skill public Skill copy() throws InstantiationException, IllegalAccessException { - return this.getClass().newInstance(); + Skill skill = this.getClass().newInstance(); + skill.setSkillID(this.skillID); + return skill; } + public void setSkillID(int i) + { + skillID = i; + } + + public int getSkillID () + { + return skillID; + } + /* Save/Load */ public void saveToNBT (NBTTagCompound tag) { diff --git a/mods/tinker/tconstruct/skill/WallBuilding.java b/mods/tinker/tconstruct/skill/WallBuilding.java index 46989045..e1850aeb 100644 --- a/mods/tinker/tconstruct/skill/WallBuilding.java +++ b/mods/tinker/tconstruct/skill/WallBuilding.java @@ -6,6 +6,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; @@ -13,7 +14,6 @@ import net.minecraftforge.common.ForgeDirection; public class WallBuilding extends Skill { - @Override public String getTextureFile (int guiscale) { @@ -34,7 +34,6 @@ public class WallBuilding extends Skill @Override public void activate (Entity entity, World world) { - if (!world.isRemote) this.active = !active; } diff --git a/mods/tinker/tconstruct/util/PHConstruct.java b/mods/tinker/tconstruct/util/PHConstruct.java index de9a7a96..0294631b 100644 --- a/mods/tinker/tconstruct/util/PHConstruct.java +++ b/mods/tinker/tconstruct/util/PHConstruct.java @@ -83,7 +83,8 @@ public class PHConstruct oreGravel = config.getBlock("Ores Gravel", 1488).getInt(1488); speedBlock = config.getBlock("Speed Block", 1489).getInt(1489); - //landmine = config.getBlock("Landmine", 1481).getInt(1481); + landmine = config.getBlock("Landmine", 1470).getInt(1470); + barricade = config.getBlock("Barricade", 1469).getInt(1469); /*golemCore = config.getBlock("Golem Core", 1481).getInt(1481); golemHead = config.getBlock("Golem Head", 1482).getInt(1482);*/ @@ -257,7 +258,8 @@ public class PHConstruct public static int netherOreBerry; //Traps - //public static int landmine; + public static int landmine; + public static int barricade; //InfiBlocks public static int speedBlock; diff --git a/mods/tinker/tconstruct/util/TEventHandler.java b/mods/tinker/tconstruct/util/TEventHandler.java index b501de22..b0e053ea 100644 --- a/mods/tinker/tconstruct/util/TEventHandler.java +++ b/mods/tinker/tconstruct/util/TEventHandler.java @@ -45,7 +45,7 @@ public class TEventHandler /* Interact */ - @ForgeSubscribe + /*@ForgeSubscribe public void interact (PlayerInteractEvent event) { if (event.action == Action.RIGHT_CLICK_BLOCK)// && !event.entityPlayer.worldObj.isRemote) @@ -57,7 +57,7 @@ public class TEventHandler walls.rightClickActivate(event.entityPlayer, event.entityPlayer.worldObj); } } - } + }*/ /*@ForgeSubscribe public void onHurt (LivingHurtEvent event) @@ -133,14 +133,14 @@ public class TEventHandler } } - @ForgeSubscribe + /*@ForgeSubscribe public void onLivingSpawn (EntityJoinWorldEvent event) { if (event.entity instanceof EntityXPOrb) { System.out.println("Entity: " + event.entity); } - } + }*/ @ForgeSubscribe public void onLivingSpawn (LivingSpawnEvent.SpecialSpawn event) diff --git a/mods/tinker/tconstruct/util/network/TPacketHandler.java b/mods/tinker/tconstruct/util/network/TPacketHandler.java index cef35108..c93f8a82 100644 --- a/mods/tinker/tconstruct/util/network/TPacketHandler.java +++ b/mods/tinker/tconstruct/util/network/TPacketHandler.java @@ -3,10 +3,14 @@ package mods.tinker.tconstruct.util.network; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; +import java.util.ArrayList; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.blocks.logic.ToolStationLogic; +import mods.tinker.tconstruct.library.SkillRegistry; import mods.tinker.tconstruct.library.blocks.InventoryLogic; +import mods.tinker.tconstruct.skill.Skill; +import mods.tinker.tconstruct.util.player.TPlayerStats; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -34,26 +38,33 @@ public class TPacketHandler implements IPacketHandler if (side == Side.SERVER) handleServerPacket(packet, (EntityPlayerMP) player); else - handleClientPacket(packet); + handleClientPacket(packet, (EntityPlayer) player); } } - void handleClientPacket (Packet250CustomPayload packet) + void handleClientPacket (Packet250CustomPayload packet, EntityPlayer player) { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); - byte packetType; - int dimension; byte packetID; try { packetID = inputStream.readByte(); - dimension = inputStream.readInt(); - - World world = DimensionManager.getWorld(dimension); + if (packetID == 1) + { + TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); + stats.skillList = new ArrayList(); + int size = inputStream.readInt(); + for (int i = 0; i < size; i++) + { + Skill skill = SkillRegistry.skillMapping.get(inputStream.readInt()).copy(); + skill.setActive(inputStream.readBoolean()); + stats.skillList.add(skill); + } + } } - catch (IOException e) + catch (Exception e) { System.out.println("Failed at reading client packet for TConstruct."); e.printStackTrace(); diff --git a/mods/tinker/tconstruct/util/player/ArmorExtended.java b/mods/tinker/tconstruct/util/player/ArmorExtended.java index 844476d6..c97a05ea 100644 --- a/mods/tinker/tconstruct/util/player/ArmorExtended.java +++ b/mods/tinker/tconstruct/util/player/ArmorExtended.java @@ -111,11 +111,11 @@ public class ArmorExtended implements IInventory { EntityPlayer player = parent.get(); TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); - recalculateSkills(player, stats); + //recalculateSkills(player, stats); recalculateHealth(player, stats); } - public void recalculateSkills(EntityPlayer player, TPlayerStats stats) + /*public void recalculateSkills(EntityPlayer player, TPlayerStats stats) { if (inventory[1] != null && inventory[1].getItem() == TContent.glove) { @@ -138,7 +138,7 @@ public class ArmorExtended implements IInventory stats.skillList.remove(0); } } - } + }*/ public void recalculateHealth(EntityPlayer player, TPlayerStats stats) { diff --git a/mods/tinker/tconstruct/util/player/TPlayerHandler.java b/mods/tinker/tconstruct/util/player/TPlayerHandler.java index 74b32431..cca89f0f 100644 --- a/mods/tinker/tconstruct/util/player/TPlayerHandler.java +++ b/mods/tinker/tconstruct/util/player/TPlayerHandler.java @@ -1,26 +1,30 @@ package mods.tinker.tconstruct.util.player; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; import java.lang.ref.WeakReference; import java.util.ArrayList; +import java.util.List; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import mods.tinker.tconstruct.common.TContent; -import mods.tinker.tconstruct.library.SkillRegistry; import mods.tinker.tconstruct.library.tools.AbilityHelper; import mods.tinker.tconstruct.skill.Skill; -import mods.tinker.tconstruct.skill.WallBuilding; import mods.tinker.tconstruct.util.PHConstruct; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumEntitySize; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingFallEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.IPlayerTracker; +import cpw.mods.fml.common.network.PacketDispatcher; +import cpw.mods.fml.common.network.Player; import cpw.mods.fml.relauncher.Side; public class TPlayerHandler implements IPlayerTracker @@ -65,22 +69,47 @@ public class TPlayerHandler implements IPlayerTracker } stats.skillList = new ArrayList(); - stats.armor.recalculateSkills(entityplayer, stats); - /*try - { - stats.skillList.add(SkillRegistry.skills.get("Wall Building").copy()); - } - catch (Exception e) - { - e.printStackTrace(); - }/* - //stats.skillList.add(new ActiveSkill(new Jump())); - /*for (Map.Entry entry : SkillRegistry.skills.entrySet()) - { - SkillBase skill = entry.getValue(); - }*/ + //stats.armor.recalculateSkills(entityplayer, stats); playerStats.put(entityplayer.username, stats); + + //sendSkills(entityplayer, stats); + } + + void sendSkills (EntityPlayer entityplayer, TPlayerStats stats) + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(8); + DataOutputStream outputStream = new DataOutputStream(bos); + List skills = stats.skillList; + + try + { + outputStream.writeByte(1); + outputStream.writeInt(skills.size()); + + for (Skill skill : stats.skillList) + { + outputStream.writeInt(skill.getSkillID()); + outputStream.writeBoolean(skill.getActive()); + } + //outputStream.writeByte(key); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + updateClientPlayer(bos, entityplayer); + } + + void updateClientPlayer (ByteArrayOutputStream bos, EntityPlayer player) + { + Packet250CustomPayload packet = new Packet250CustomPayload(); + packet.channel = "TConstruct"; + packet.data = bos.toByteArray(); + packet.length = bos.size(); + + PacketDispatcher.sendPacketToPlayer(packet, (Player) player); } public void activateSkill (EntityPlayer player, int slot) @@ -163,19 +192,7 @@ public class TPlayerHandler implements IPlayerTracker { if (evt.entityLiving instanceof EntityPlayer) { - /*Side side = FMLCommonHandler.instance().getEffectiveSide(); - if (side == Side.CLIENT) - { - TProxyClient.controlInstance.landOnGround(); - }*/ - //else - //System.out.println("Server side"); - evt.distance -= 1; - //evt.distance = 0; - //TPlayerStats stats = playerStats.get(((EntityPlayer)evt.entityLiving).username); - //stats.prevMotionY = evt.entityLiving.motionY; - //evt.entityLiving.motionY = 10.2; } } @@ -239,7 +256,7 @@ public class TPlayerHandler implements IPlayerTracker return stats.player.get(); } } - + /* Modify Player */ public void updateSize (String user, float offset) { @@ -291,69 +308,4 @@ public class TPlayerHandler implements IPlayerTracker Random rand = new Random(); - /* Bows */ - /*@ForgeSubscribe - public void arrowShoot (ArrowLooseEvent event) - { - event.setCanceled(true); - int j = event.charge; - - boolean flag = event.entityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, event.bow) > 0; - - if (flag || event.entityPlayer.inventory.hasItem(Item.arrow.itemID)) - { - float f = (float) j / 20.0F; - f = (f * f + f * 2.0F) / 3.0F; - - if ((double) f < 0.1D) - { - return; - } - - if (f > 1.0F) - { - f = 1.0F; - } - - EntityArrow entityarrow = new EntityArrow(event.entityPlayer.worldObj, event.entityPlayer, f * 2.0F); - - if (f == 1.0F) - { - entityarrow.setIsCritical(true); - } - - int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, event.bow); - - entityarrow.setDamage(1.5D + k * 0.45D); - - int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, event.bow); - - if (l > 0) - { - entityarrow.setKnockbackStrength(l); - } - - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, event.bow) > 0) - { - entityarrow.setFire(100); - } - - event.bow.damageItem(1, event.entityPlayer); - event.entityPlayer.worldObj.playSoundAtEntity(event.entityPlayer, "random.bow", 1.0F, 1.0F / (rand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); - - if (flag) - { - entityarrow.canBePickedUp = 2; - } - else - { - event.entityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID); - } - - if (!event.entityPlayer.worldObj.isRemote) - { - event.entityPlayer.worldObj.spawnEntityInWorld(entityarrow); - } - } - }*/ }