diff --git a/resources/assets/tinker/lang/de_DE.lang b/resources/assets/tinker/lang/de_DE.lang index 5cadd110..84198eb8 100644 --- a/resources/assets/tinker/lang/de_DE.lang +++ b/resources/assets/tinker/lang/de_DE.lang @@ -274,9 +274,6 @@ LavaTank.Tank.name=Versengter Tank LavaTank.Gague.name=Versengtes Glas LavaTank.Window.name=Versengtes Fenster -block.drawbridge.name=Zugbrücke -block.firestarter.name=Entzünder -block.advdrawbridge.name=Fortgeschrittene Zugbrücke tile.landmine.name=Landmine tile.trap.punji.name=Punji-Stab diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index d806af6d..1d2e4dd6 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -274,9 +274,6 @@ LavaTank.Tank.name=Seared Tank LavaTank.Gague.name=Seared Glass LavaTank.Window.name=Seared Window -block.drawbridge.name=Drawbridge -block.firestarter.name=Igniter -block.advdrawbridge.name=Advanced Drawbridge tile.landmine.name=Landmine tile.trap.punji.name=Punji Stick diff --git a/resources/assets/tinker/lang/it_IT.lang b/resources/assets/tinker/lang/it_IT.lang index 2a52f19d..969dec07 100644 --- a/resources/assets/tinker/lang/it_IT.lang +++ b/resources/assets/tinker/lang/it_IT.lang @@ -274,9 +274,6 @@ LavaTank.Tank.name=Serbatoio della Fonderia/entry> LavaTank.Gague.name=Vetro di Mattoni Bruciati LavaTank.Window.name=Finestra di Mattoni Bruciati -block.drawbridge.name=Ponte Mobile -block.firestarter.name=Accendino -block.advdrawbridge.name=Ponte Mobile Avanzato tile.landmine.name=Mina tile.trap.punji.name=Bastone Punji diff --git a/resources/assets/tinker/lang/pl_PL.lang b/resources/assets/tinker/lang/pl_PL.lang index 54221840..0b42950a 100644 --- a/resources/assets/tinker/lang/pl_PL.lang +++ b/resources/assets/tinker/lang/pl_PL.lang @@ -157,8 +157,6 @@ LavaTank.Tank.name=Hartowany zbiornik LavaTank.Gague.name=Hartowane szkło LavaTank.Window.name=Hartowane okno -block.drawbridge.name=Most zwodzony -block.firestarter.name=Zapalnikr tile.landmine.name=Mina lądowa tile.trap.punji.name=Kolce punji tile.trap.barricade.oak.name=Dębowa barykada diff --git a/resources/assets/tinker/lang/ru_RU.lang b/resources/assets/tinker/lang/ru_RU.lang index 9503b4dd..fd080f7f 100644 --- a/resources/assets/tinker/lang/ru_RU.lang +++ b/resources/assets/tinker/lang/ru_RU.lang @@ -175,8 +175,6 @@ LavaTank.Tank.name=Обожжённый резервуар LavaTank.Gague.name=Обожжённое стекло LavaTank.Window.name=Обожжённое окно -block.drawbridge.name=Разводной мост -block.firestarter.name=Воспламенитель tile.landmine.name=Фугас tile.trap.punji.name=Колышек tile.trap.barricade.oak.name=Баррикада из дуба diff --git a/resources/assets/tinker/lang/zh_CN.lang b/resources/assets/tinker/lang/zh_CN.lang index 5e6e3373..40e468f8 100644 --- a/resources/assets/tinker/lang/zh_CN.lang +++ b/resources/assets/tinker/lang/zh_CN.lang @@ -281,9 +281,6 @@ LavaTank.Tank.name=冶炼槽 LavaTank.Gague.name=冶炼炉玻璃 LavaTank.Window.name=冶炼炉视窗 -block.drawbridge.name=造桥器 -block.firestarter.name=点火器 -block.advdrawbridge.name=高级造桥器 tile.landmine.name=地雷 tile.trap.punji.name=铁蒺藜 diff --git a/resources/assets/tinker/textures/blocks/machines/drawbridge_bottom.png b/resources/assets/tinker/textures/blocks/machines/drawbridge_bottom.png deleted file mode 100644 index e77f9531..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/drawbridge_bottom.png and /dev/null differ diff --git a/resources/assets/tinker/textures/blocks/machines/drawbridge_bottom_face.png b/resources/assets/tinker/textures/blocks/machines/drawbridge_bottom_face.png deleted file mode 100644 index 34f32937..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/drawbridge_bottom_face.png and /dev/null differ diff --git a/resources/assets/tinker/textures/blocks/machines/drawbridge_side.png b/resources/assets/tinker/textures/blocks/machines/drawbridge_side.png deleted file mode 100644 index 4d4b7b3b..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/drawbridge_side.png and /dev/null differ diff --git a/resources/assets/tinker/textures/blocks/machines/drawbridge_side_face.png b/resources/assets/tinker/textures/blocks/machines/drawbridge_side_face.png deleted file mode 100644 index 99cf6598..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/drawbridge_side_face.png and /dev/null differ diff --git a/resources/assets/tinker/textures/blocks/machines/drawbridge_top.png b/resources/assets/tinker/textures/blocks/machines/drawbridge_top.png deleted file mode 100644 index 7f89b409..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/drawbridge_top.png and /dev/null differ diff --git a/resources/assets/tinker/textures/blocks/machines/drawbridge_top_face.png b/resources/assets/tinker/textures/blocks/machines/drawbridge_top_face.png deleted file mode 100644 index 9e876e6f..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/drawbridge_top_face.png and /dev/null differ diff --git a/resources/assets/tinker/textures/blocks/machines/firestarter_bottom.png b/resources/assets/tinker/textures/blocks/machines/firestarter_bottom.png deleted file mode 100644 index 1f90f773..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/firestarter_bottom.png and /dev/null differ diff --git a/resources/assets/tinker/textures/blocks/machines/firestarter_side.png b/resources/assets/tinker/textures/blocks/machines/firestarter_side.png deleted file mode 100644 index 3b04eaa0..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/firestarter_side.png and /dev/null differ diff --git a/resources/assets/tinker/textures/blocks/machines/firestarter_top.png b/resources/assets/tinker/textures/blocks/machines/firestarter_top.png deleted file mode 100644 index fdca31de..00000000 Binary files a/resources/assets/tinker/textures/blocks/machines/firestarter_top.png and /dev/null differ diff --git a/resources/assets/tinker/textures/gui/drawbridge.png b/resources/assets/tinker/textures/gui/drawbridge.png deleted file mode 100644 index f247f1d0..00000000 Binary files a/resources/assets/tinker/textures/gui/drawbridge.png and /dev/null differ diff --git a/resources/assets/tinker/textures/gui/drawbridgeAdvanced.png b/resources/assets/tinker/textures/gui/drawbridgeAdvanced.png deleted file mode 100644 index d146b1a9..00000000 Binary files a/resources/assets/tinker/textures/gui/drawbridgeAdvanced.png and /dev/null differ diff --git a/resources/assets/tinker/textures/gui/slotButton.png b/resources/assets/tinker/textures/gui/slotButton.png deleted file mode 100644 index 4cdd631f..00000000 Binary files a/resources/assets/tinker/textures/gui/slotButton.png and /dev/null differ diff --git a/resources/assets/tinker/textures/items/logic/lengthwire.png b/resources/assets/tinker/textures/items/logic/lengthwire.png deleted file mode 100644 index 2dab64df..00000000 Binary files a/resources/assets/tinker/textures/items/logic/lengthwire.png and /dev/null differ diff --git a/resources/assets/tinker/textures/items/logic/spoolwire.png b/resources/assets/tinker/textures/items/logic/spoolwire.png deleted file mode 100644 index 5b86b6cf..00000000 Binary files a/resources/assets/tinker/textures/items/logic/spoolwire.png and /dev/null differ diff --git a/src/tconstruct/blocks/FurnaceSlab.java b/src/tconstruct/blocks/FurnaceSlab.java index 895fdbe0..4aa17e19 100644 --- a/src/tconstruct/blocks/FurnaceSlab.java +++ b/src/tconstruct/blocks/FurnaceSlab.java @@ -10,8 +10,6 @@ import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import tconstruct.TConstruct; -import tconstruct.blocks.logic.AdvancedDrawbridgeLogic; -import tconstruct.blocks.logic.DrawbridgeLogic; import tconstruct.blocks.logic.FurnaceLogic; import tconstruct.common.TProxyCommon; import tconstruct.library.TConstructRegistry; diff --git a/src/tconstruct/blocks/RedstoneMachine.java b/src/tconstruct/blocks/RedstoneMachine.java deleted file mode 100644 index c2fe7a4a..00000000 --- a/src/tconstruct/blocks/RedstoneMachine.java +++ /dev/null @@ -1,420 +0,0 @@ -package tconstruct.blocks; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.Icon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; -import tconstruct.TConstruct; -import tconstruct.blocks.logic.AdvancedDrawbridgeLogic; -import tconstruct.blocks.logic.DrawbridgeLogic; -import tconstruct.blocks.logic.FirestarterLogic; -import tconstruct.client.block.MachineRender; -import tconstruct.library.TConstructRegistry; -import tconstruct.library.blocks.InventoryBlock; -import tconstruct.library.util.CoordTuple; -import tconstruct.library.util.IActiveLogic; -import tconstruct.library.util.IFacingLogic; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class RedstoneMachine extends InventoryBlock -{ - public RedstoneMachine(int id) - { - super(id, Material.iron); - this.setCreativeTab(TConstructRegistry.blockTab); - setHardness(12); - setStepSound(soundMetalFootstep); - } - - @Override - public int getLightValue (IBlockAccess world, int x, int y, int z) - { - if (world.getBlockMetadata(x, y, z) == 0 || world.getBlockMetadata(x, y, z) == 2) - { - TileEntity logic = world.getBlockTileEntity(x, y, z); - - if (logic != null && logic instanceof DrawbridgeLogic) - { - if (((DrawbridgeLogic) logic).getStackInSlot(1) != null) - { - ItemStack stack = ((DrawbridgeLogic) logic).getStackInSlot(1); - if (stack.itemID < 4096 && Block.blocksList[stack.itemID] != null) - return lightValue[stack.itemID]; - } - } - - if (logic != null && logic instanceof AdvancedDrawbridgeLogic) - { - if (((AdvancedDrawbridgeLogic) logic).camoInventory.getCamoStack() != null) - { - ItemStack stack = ((AdvancedDrawbridgeLogic) logic).camoInventory.getCamoStack(); - if (stack.itemID < 4096 && Block.blocksList[stack.itemID] != null) - return lightValue[stack.itemID]; - } - } - } - return super.getLightValue(world, x, y, z); - } - - @Override - @SideOnly(Side.CLIENT) - public int colorMultiplier (IBlockAccess world, int x, int y, int z) - { - if (world.getBlockMetadata(x, y, z) == 0 && world.getBlockMetadata(x, y, z) == 2) - { - TileEntity logic = world.getBlockTileEntity(x, y, z); - - if (logic != null && logic instanceof DrawbridgeLogic) - { - ItemStack stack = ((DrawbridgeLogic) logic).getStackInSlot(1); - if (stack != null && stack.itemID < 4096 && Block.blocksList[stack.itemID] != null && stack.itemID != this.blockID) - return Block.blocksList[stack.itemID].colorMultiplier(world, x, y, z); - } - else if (logic != null && logic instanceof AdvancedDrawbridgeLogic) - { - ItemStack stack = ((AdvancedDrawbridgeLogic) logic).camoInventory.getCamoStack(); - if (stack != null && stack.itemID < 4096 && Block.blocksList[stack.itemID] != null && stack.itemID != this.blockID) - return Block.blocksList[stack.itemID].colorMultiplier(world, x, y, z); - } - } - - return 0xffffff; - } - - @Override - public TileEntity createTileEntity (World world, int metadata) - { - switch (metadata) - { - case 0: - return new DrawbridgeLogic(); - case 1: - return new FirestarterLogic(); - case 2: - return new AdvancedDrawbridgeLogic(); - default: - return null; - } - } - - @Override - public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer) - { - int meta = world.getBlockMetadata(x, y, z); - switch (meta) - { - case 0: - return TConstruct.proxy.drawbridgeID; - case 2: - return TConstruct.proxy.advDrawbridgeID; - } - return null; - } - - @Override - public Object getModInstance () - { - return TConstruct.instance; - } - - /* Rendering */ - - @Override - public String[] getTextureNames () - { - String[] textureNames = { "drawbridge_top", "drawbridge_side", "drawbridge_bottom", "drawbridge_top_face", "drawbridge_side_face", "drawbridge_bottom_face", "firestarter_top", - "firestarter_side", "firestarter_bottom" }; - - return textureNames; - } - - @Override - public void registerIcons (IconRegister iconRegister) - { - String[] textureNames = getTextureNames(); - this.icons = new Icon[textureNames.length]; - - for (int i = 0; i < this.icons.length; ++i) - { - this.icons[i] = iconRegister.registerIcon("tinker:machines/" + textureNames[i]); - } - } - - @Override - public Icon getIcon (int side, int meta) - { - if (meta == 0 || meta == 2) - { - if (side == 5) - return icons[5]; - return icons[getTextureIndex(side)]; - } - if (meta == 1) - { - return icons[getTextureIndex(side) + 6]; - } - return icons[0]; - } - - public Icon getBlockTexture (IBlockAccess world, int x, int y, int z, int side) - { - TileEntity logic = world.getBlockTileEntity(x, y, z); - short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getRenderDirection() : 0; - int meta = world.getBlockMetadata(x, y, z); - if (meta == 0) - { - DrawbridgeLogic drawbridge = (DrawbridgeLogic) logic; - ItemStack stack = drawbridge.getStackInSlot(1); - if (stack != null && stack.itemID < 4096) - { - Block block = Block.blocksList[stack.itemID]; - if (block != null && block.renderAsNormalBlock()) - return block.getIcon(side, stack.getItemDamage()); - } - if (side == direction) - { - return icons[getTextureIndex(side) + 3]; - } - else - { - return icons[getTextureIndex(side)]; - } - } - - if (meta == 2) - { - AdvancedDrawbridgeLogic drawbridge = (AdvancedDrawbridgeLogic) logic; - ItemStack stack = drawbridge.camoInventory.getCamoStack(); - if (stack != null && stack.itemID < 4096) - { - Block block = Block.blocksList[stack.itemID]; - if (block != null && block.renderAsNormalBlock()) - return block.getIcon(side, stack.getItemDamage()); - } - if (side == direction) - { - return icons[getTextureIndex(side) + 3]; - } - else - { - return icons[getTextureIndex(side)]; - } - } - - if (meta == 1) - { - if (side == direction) - { - return icons[6]; - } - else if (side / 2 == direction / 2) - { - return icons[8]; - } - return icons[7]; - } - return icons[0]; - } - - public int getTextureIndex (int side) - { - if (side == 0) - return 2; - if (side == 1) - return 0; - - return 1; - } - - public int getRenderType () - { - return MachineRender.model; - } - - public boolean isFireSource (World world, int x, int y, int z, int metadata, ForgeDirection side) - { - if (metadata == 1) - return side == ForgeDirection.UP; - return false; - } - - @Override - public void getSubBlocks (int id, CreativeTabs tab, List list) - { - for (int iter = 0; iter < 3; iter++) - { - list.add(new ItemStack(id, 1, iter)); - } - } - - /* Redstone */ - public void onNeighborBlockChange (World world, int x, int y, int z, int neighborBlockID) - { - IActiveLogic logic = (IActiveLogic) world.getBlockTileEntity(x, y, z); - IFacingLogic facing = (IFacingLogic) logic; - int direction = facing.getRenderDirection(); - boolean active = false; - for (int i = 0; i < 6; i++) - { - 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)) - { - active = true; - break; - } - } - logic.setActive(active); - } - - public int getIndirectPowerLevelTo (World world, int x, int y, int z, int side) - { - if (world.isBlockNormalCube(x, y, z)) - { - return world.getBlockPowerInput(x, y, z); - } - else - { - int i1 = world.getBlockId(x, y, z); - return i1 == 0 ? 0 : Block.blocksList[i1].isProvidingWeakPower(world, x, y, z, side); - } - } - - boolean activeRedstone (World world, int x, int y, int z) - { - Block wire = Block.blocksList[world.getBlockId(x, y, z)]; - if (wire != null && wire.blockID == Block.redstoneWire.blockID) - return world.getBlockMetadata(x, y, z) > 0; - - return false; - } - - /* Keep inventory */ - @Override - public boolean removeBlockByPlayer (World world, EntityPlayer player, int x, int y, int z) - { - player.addExhaustion(0.025F); - int meta = world.getBlockMetadata(x, y, z); - if (meta == 0) - { - ItemStack stack = new ItemStack(this.blockID, 1, meta); - DrawbridgeLogic logic = (DrawbridgeLogic) world.getBlockTileEntity(x, y, z); - NBTTagCompound tag = new NBTTagCompound(); - - boolean hasTag = false; - ItemStack contents = logic.getStackInSlot(0); - if (contents != null) - { - NBTTagCompound contentTag = new NBTTagCompound(); - contents.writeToNBT(contentTag); - tag.setCompoundTag("Contents", contentTag); - hasTag = true; - } - - ItemStack camo = logic.getStackInSlot(1); - if (camo != null) - { - NBTTagCompound camoTag = new NBTTagCompound(); - camo.writeToNBT(camoTag); - tag.setCompoundTag("Camoflauge", camoTag); - hasTag = true; - } - - if (logic.getPlacementDirection() != 4) - { - tag.setByte("Placement", logic.getPlacementDirection()); - hasTag = true; - } - if (hasTag == true) - stack.setTagCompound(tag); - - dropDrawbridgeLogic(world, x, y, z, stack); - } - - return world.setBlockToAir(x, y, z); - } - - protected void dropDrawbridgeLogic (World world, int x, int y, int z, ItemStack stack) - { - if (!world.isRemote && world.getGameRules().getGameRuleBooleanValue("doTileDrops")) - { - float f = 0.7F; - double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, stack); - entityitem.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(entityitem); - } - } - - @Override - public void harvestBlock (World world, EntityPlayer player, int x, int y, int z, int meta) - { - if (meta != 0) - super.harvestBlock(world, player, x, y, z, meta); - } - - @Override - public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase living, ItemStack stack) - { - super.onBlockPlacedBy(world, x, y, z, living, stack); - if (stack.hasTagCompound()) - { - DrawbridgeLogic logic = (DrawbridgeLogic) world.getBlockTileEntity(x, y, z); - NBTTagCompound contentTag = stack.getTagCompound().getCompoundTag("Contents"); - if (contentTag != null) - { - ItemStack contents = ItemStack.loadItemStackFromNBT(contentTag); - logic.setInventorySlotContents(0, contents); - } - - NBTTagCompound camoTag = stack.getTagCompound().getCompoundTag("Camoflauge"); - if (camoTag != null) - { - ItemStack camoflauge = ItemStack.loadItemStackFromNBT(camoTag); - logic.setInventorySlotContents(1, camoflauge); - } - - if (stack.getTagCompound().hasKey("Placement")) - { - logic.setPlacementDirection(stack.getTagCompound().getByte("Placement")); - } - } - } - - /* Redstone connections */ - - public boolean canConnectRedstone (IBlockAccess world, int x, int y, int z, int side) - { - return true; - } - - static ArrayList directions = new ArrayList(6); - - static - { - directions.add(new CoordTuple(0, -1, 0)); - directions.add(new CoordTuple(0, 1, 0)); - directions.add(new CoordTuple(0, 0, -1)); - directions.add(new CoordTuple(0, 0, 1)); - directions.add(new CoordTuple(-1, 0, 0)); - directions.add(new CoordTuple(1, 0, 0)); - } -} diff --git a/src/tconstruct/blocks/logic/AdvancedDrawbridgeLogic.java b/src/tconstruct/blocks/logic/AdvancedDrawbridgeLogic.java deleted file mode 100644 index 088615f4..00000000 --- a/src/tconstruct/blocks/logic/AdvancedDrawbridgeLogic.java +++ /dev/null @@ -1,641 +0,0 @@ -package tconstruct.blocks.logic; - -import net.minecraft.inventory.InventoryBasic; - -import net.minecraft.nbt.NBTTagList; - -import java.util.ArrayList; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.*; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.*; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; -import tconstruct.inventory.AdvancedDrawbridgeContainer; -import tconstruct.library.TConstructRegistry; -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; - - ItemStack[] bufferStacks = new ItemStack[getSizeInventory()]; - - 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; - } - - @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); - } - - @Override - protected String getDefaultName () - { - return "tinker.drawbridge"; - } - - @Override - public ItemStack decrStackSize (int slot, int quantity) - { - ItemStack stack = super.decrStackSize(slot, quantity); - if (slot == 1) - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - return stack; - } - - 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; - } - - 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; - - 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; - } - } - } - } - } - - /** - * 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; - } - - if (world.getBlockId(x, y, z) == block.blockID) - { - block.onBlockPlacedBy(world, x, y, z, player, stack); - block.onPostBlockPlaced(world, x, y, z, metadata); - } - - return true; - } - - 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; - } - - 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; - } - - @Override - public void readFromNBT (NBTTagCompound tags) - { - super.readFromNBT(tags); - active = tags.getBoolean("Active"); - working = tags.getBoolean("Working"); - extension = tags.getByte("Extension"); - - NBTTagCompound camoTag = (NBTTagCompound) tags.getTag("Camo"); - if (camoTag != null) - { - camoInventory.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(camoTag)); - } - - readBufferFromNBT(tags); - readCustomNBT(tags); - } - - @Override - public void writeToNBT (NBTTagCompound tags) - { - super.writeToNBT(tags); - tags.setBoolean("Active", active); - tags.setBoolean("Working", working); - tags.setByte("Extension", extension); - - if (camoInventory.getStackInSlot(0) != null) - { - NBTTagCompound camoTag = new NBTTagCompound(); - camoInventory.getStackInSlot(0).writeToNBT(camoTag); - tags.setTag("Camo", camoTag); - } - - writeBufferToNBT(tags); - writeCustomNBT(tags); - } - - 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 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); - } - } - - tags.setTag("Buffer", nbttaglist); - } - - public void readCustomNBT (NBTTagCompound tags) - { - direction = tags.getByte("Direction"); - placementDirection = tags.getByte("Placement"); - } - - public void writeCustomNBT (NBTTagCompound tags) - { - tags.setByte("Direction", direction); - tags.setByte("Placement", placementDirection); - } - - /* Packets */ - @Override - public Packet getDescriptionPacket () - { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag); - } - - @Override - public void onDataPacket (INetworkManager net, Packet132TileEntityData packet) - { - readFromNBT(packet.data); - worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); - } - - public boolean hasExtended () - { - return extension != 0; - } - - @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 int getMaxSize() { - // return 16; - // } - - @Override - public int getInventoryStackLimit () - { - return 1; - } - - public class InvCamo extends InventoryBasic - { - - private InvCamo() - { - super("camoSlot", false, 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/DrawbridgeLogic.java b/src/tconstruct/blocks/logic/DrawbridgeLogic.java deleted file mode 100644 index 39ee9263..00000000 --- a/src/tconstruct/blocks/logic/DrawbridgeLogic.java +++ /dev/null @@ -1,537 +0,0 @@ -package tconstruct.blocks.logic; - -import tconstruct.library.blocks.IDrawbridgeLogicBase; - -import net.minecraft.nbt.NBTTagCompound; - -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.*; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.*; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.*; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeDirection; -import tconstruct.inventory.DrawbridgeContainer; -import tconstruct.library.TConstructRegistry; -import tconstruct.library.blocks.InventoryLogic; -import tconstruct.library.util.*; -import tconstruct.util.player.FakePlayerLogic; - -public class DrawbridgeLogic extends InventoryLogic implements IFacingLogic, IActiveLogic, IDrawbridgeLogicBase -{ - boolean active; - boolean working; - int ticks; - byte extension; - byte direction; - byte placementDirection = 4; - FakePlayerLogic fakePlayer; - - ItemStack bufferStack = null; - - public DrawbridgeLogic() - { - super(2); - } - - @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; - } - - @Override - public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z) - { - return new DrawbridgeContainer(inventoryplayer, this); - } - - @Override - protected String getDefaultName () - { - return "tinker.drawbridge"; - } - - @Override - public void setInventorySlotContents (int slot, ItemStack itemstack) - { - super.setInventorySlotContents(slot, itemstack); - if (slot == 1) - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - - @Override - public ItemStack decrStackSize (int slot, int quantity) - { - ItemStack stack = super.decrStackSize(slot, quantity); - if (slot == 1) - worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - return stack; - } - - public void updateEntity () - { - if (working) - { - ticks++; - if (ticks == 5) - { - ticks = 0; - if (active) //Placement - { - if (inventory[0] != null && inventory[0].stackSize > 0 && extension < 15) - { - extension++; - int xPos = xCoord; - int yPos = yCoord; - int zPos = zCoord; - - bufferStack = inventory[0].copy(); - bufferStack.stackSize = 1; - - 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 || block.isAirBlock(worldObj, xPos, yPos, zPos) || block.isBlockReplaceable(worldObj, xPos, yPos, zPos)) - { - //tryExtend(worldObj, xPos, yPos, zPos, direction); - int blockToItem = TConstructRegistry.blockToItemMapping[bufferStack.itemID]; - if (blockToItem == 0) - { - if (inventory[0].itemID >= 4096 || Block.blocksList[inventory[0].itemID] == null) - return; - Block placeBlock = Block.blocksList[bufferStack.itemID]; - placeBlockAt(bufferStack, fakePlayer, worldObj, xPos, yPos, zPos, direction, 0, 0, 0, bufferStack.getItemDamage(), placeBlock); - } - else - { - Block placeBlock = Block.blocksList[blockToItem]; - placeBlockAt(bufferStack, fakePlayer, worldObj, xPos, yPos, zPos, direction, 0, 0, 0, bufferStack.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(0, 1); - } - else - { - extension--; - working = false; - } - } - - else - { - working = false; - } - } - else - //Retraction - { - if ((inventory[0] == null || inventory[0].stackSize < inventory[0].getMaxStackSize()) && extension > 0) - { - 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; - } - - Block block = Block.blocksList[worldObj.getBlockId(xPos, yPos, zPos)]; - if (block != null) - { - int meta = worldObj.getBlockMetadata(xPos, yPos, zPos); - if (bufferStack != null && validBlock(block) && validMetadata(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 (inventory[0] == null) - { - inventory[0] = bufferStack.copy(); - } - else - { - inventory[0].stackSize++; - } - } - else - { - working = false; - } - } - extension--; - } - else - { - working = false; - } - } - } - } - } - - /** - * 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; - } - - if (world.getBlockId(x, y, z) == block.blockID) - { - block.onBlockPlacedBy(world, x, y, z, player, stack); - block.onPostBlockPlaced(world, x, y, z, metadata); - } - - return true; - } - - boolean validBlock (Block block) - { - int type = TConstructRegistry.interchangableBlockMapping[block.blockID]; - if (type != 0) - { - if (type == bufferStack.itemID) - return true; - } - int blockToItem = TConstructRegistry.blockToItemMapping[block.blockID]; - if (blockToItem != 0) - { - if (blockToItem == bufferStack.itemID) - return true; - } - return block.blockID == bufferStack.itemID; - } - - boolean validMetadata (int blockID, int metadata) - { - int type = TConstructRegistry.drawbridgeState[blockID]; - if (type == 0) - { - return metadata == bufferStack.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 == bufferStack.getItemDamage(); - } - return false; - } - - @Override - public void readFromNBT (NBTTagCompound tags) - { - super.readFromNBT(tags); - 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 (bufferStack == null && inventory[0] != null) - { - bufferStack = inventory[0]; - } - - readCustomNBT(tags); - } - - @Override - public void writeToNBT (NBTTagCompound tags) - { - super.writeToNBT(tags); - 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); - } - - writeCustomNBT(tags); - } - - public void readCustomNBT (NBTTagCompound tags) - { - direction = tags.getByte("Direction"); - placementDirection = tags.getByte("Placement"); - } - - public void writeCustomNBT (NBTTagCompound tags) - { - tags.setByte("Direction", direction); - tags.setByte("Placement", placementDirection); - } - - /* Packets */ - @Override - public Packet getDescriptionPacket () - { - NBTTagCompound tag = new NBTTagCompound(); - writeToNBT(tag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag); - } - - @Override - public void onDataPacket (INetworkManager net, Packet132TileEntityData packet) - { - readFromNBT(packet.data); - worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); - } - - public boolean hasExtended () - { - return extension != 0; - } - - @Override - public void onInventoryChanged () - { - super.onInventoryChanged(); - if (getStackInSlot(0) != null) - { - bufferStack = getStackInSlot(0).copy(); - bufferStack.stackSize = 1; - } - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } -} diff --git a/src/tconstruct/blocks/logic/FirestarterLogic.java b/src/tconstruct/blocks/logic/FirestarterLogic.java deleted file mode 100644 index 57e2fb4b..00000000 --- a/src/tconstruct/blocks/logic/FirestarterLogic.java +++ /dev/null @@ -1,197 +0,0 @@ -package tconstruct.blocks.logic; - -import tconstruct.TConstruct; -import tconstruct.library.tools.AbilityHelper; -import tconstruct.library.util.IActiveLogic; -import tconstruct.library.util.IFacingLogic; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet132TileEntityData; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MathHelper; -import net.minecraftforge.common.ForgeDirection; - -public class FirestarterLogic extends TileEntity implements IFacingLogic, IActiveLogic -{ - boolean active; - //boolean putOut; - boolean shouldActivate; - byte direction; - - @Override - public boolean getActive () - { - return active; - } - - @Override - public void setActive (boolean flag) - { - /*if (active && !flag) - { - putOut = true; - }*/ - - active = flag; - shouldActivate = true; - //setFire(); - } - - void setFire () - { - int xPos = xCoord; - int yPos = yCoord; - int zPos = zCoord; - - switch (direction) - { - case 0: - yPos -= 1; - break; - case 1: - yPos += 1; - break; - case 2: - zPos -= 1; - break; - case 3: - zPos += 1; - break; - case 4: - xPos -= 1; - break; - case 5: - xPos += 1; - break; - } - - Block block = Block.blocksList[worldObj.getBlockId(xPos, yPos, zPos)]; - if (active) - { - TConstruct.logger.info("Setting fire"); - if (block == null || block.isAirBlock(worldObj, xPos, yPos, zPos)) - { - worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "fire.ignite", 1.0F, AbilityHelper.random.nextFloat() * 0.4F + 0.8F); - worldObj.setBlock(xPos, yPos, zPos, Block.fire.blockID); - } - } - else - { - //TConstruct.logger.info("Stopping fire "+putOut); - if (block == Block.fire) - { - //worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "random.fizz", 1.0F, AbilityHelper.random.nextFloat() * 0.4F + 0.8F); - worldObj.playSoundEffect((double) xPos + 0.5D, (double) yPos + 0.5D, (double) zPos + 0.5D, "fire.ignite", 1.0F, AbilityHelper.random.nextFloat() * 0.4F + 0.8F); - worldObj.setBlock(xPos, yPos, zPos, 0, 0, 3); - //putOut = false; - shouldActivate = true; - } - } - } - - public void updateEntity () - { - if (shouldActivate) - { - shouldActivate = false; - setFire(); - } - } - - @Override - public byte getRenderDirection () - { - return direction; - } - - @Override - public ForgeDirection getForgeDirection () - { - return ForgeDirection.VALID_DIRECTIONS[direction]; - } - - @Override - public void setDirection (int side) - { - } - - @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; - } - } - } - - @Override - public void readFromNBT (NBTTagCompound tags) - { - super.readFromNBT(tags); - tags.setBoolean("Active", active); - readCustomNBT(tags); - } - - @Override - public void writeToNBT (NBTTagCompound tags) - { - super.writeToNBT(tags); - active = tags.getBoolean("Active"); - writeCustomNBT(tags); - } - - public void readCustomNBT (NBTTagCompound tags) - { - direction = tags.getByte("Direction"); - } - - public void writeCustomNBT (NBTTagCompound tags) - { - tags.setByte("Direction", direction); - } - - /* Packets */ - @Override - public Packet getDescriptionPacket () - { - NBTTagCompound tag = new NBTTagCompound(); - writeCustomNBT(tag); - return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag); - } - - @Override - public void onDataPacket (INetworkManager net, Packet132TileEntityData packet) - { - readCustomNBT(packet.data); - worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord); - } -} diff --git a/src/tconstruct/client/TProxyClient.java b/src/tconstruct/client/TProxyClient.java index c00046c5..7a12430c 100644 --- a/src/tconstruct/client/TProxyClient.java +++ b/src/tconstruct/client/TProxyClient.java @@ -81,14 +81,12 @@ public class TProxyClient extends TProxyCommon return new StencilTableGui(player.inventory, (StencilTableLogic) world.getBlockTileEntity(x, y, z), world, x, y, z); if (ID == toolForgeID) return new ToolForgeGui(player.inventory, (ToolForgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z); - if (ID == drawbridgeID) - return new DrawbridgeGui(player.inventory, (DrawbridgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z); + if (ID == landmineID) return new GuiLandmine(new ContainerLandmine(player, (TileEntityLandmine) world.getBlockTileEntity(x, y, z))); if (ID == craftingStationID) return new CraftingStationGui(player.inventory, (CraftingStationLogic) world.getBlockTileEntity(x, y, z), x, y, z); - if (ID == advDrawbridgeID) - return new AdvDrawbridgeGui(player, (AdvancedDrawbridgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z); + if (ID == furnaceID) return new FurnaceGui(player.inventory, (FurnaceLogic) world.getBlockTileEntity(x, y, z)); @@ -215,7 +213,6 @@ public class TProxyClient extends TProxyCommon RenderingRegistry.registerBlockHandler(new SearedRender()); RenderingRegistry.registerBlockHandler(new OreberryRender()); RenderingRegistry.registerBlockHandler(new BarricadeRender()); - RenderingRegistry.registerBlockHandler(new MachineRender()); RenderingRegistry.registerBlockHandler(new DryingRackRender()); RenderingRegistry.registerBlockHandler(new PaneRender()); RenderingRegistry.registerBlockHandler(new PaneConnectedRender()); @@ -503,11 +500,6 @@ public class TProxyClient extends TProxyCommon ItemStack blankCast = new ItemStack(TContent.blankPattern, 1, 1); ItemStack redstone = new ItemStack(Item.redstone); - TConstructClientRegistry.registerManualLargeRecipe("drawbridge", new ItemStack(TContent.redstoneMachine, 1, 0), alubrassIngot, blankCast, alubrassIngot, bronzeIngot, new ItemStack( - Block.dispenser), bronzeIngot, bronzeIngot, redstone, bronzeIngot); - TConstructClientRegistry.registerManualLargeRecipe("igniter", new ItemStack(TContent.redstoneMachine, 1, 1), alubrassIngot, new ItemStack(TContent.largePlate, 1, 7), alubrassIngot, - bronzeIngot, new ItemStack(Item.flintAndSteel), bronzeIngot, bronzeIngot, redstone, bronzeIngot); - // Modifier recipes ItemStack ironpick = ToolBuilder.instance.buildTool(new ItemStack(TContent.pickaxeHead, 1, 6), new ItemStack(TContent.toolRod, 1, 2), new ItemStack(TContent.binding, 1, 6), ""); TConstructClientRegistry.registerManualIcon("ironpick", ironpick); diff --git a/src/tconstruct/client/block/MachineRender.java b/src/tconstruct/client/block/MachineRender.java deleted file mode 100644 index 171c41d2..00000000 --- a/src/tconstruct/client/block/MachineRender.java +++ /dev/null @@ -1,102 +0,0 @@ -package tconstruct.client.block; - -import tconstruct.client.TProxyClient; -import tconstruct.library.util.IFacingLogic; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.world.IBlockAccess; -import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; -import cpw.mods.fml.client.registry.RenderingRegistry; - -public class MachineRender implements ISimpleBlockRenderingHandler -{ - public static int model = RenderingRegistry.getNextAvailableRenderId(); - - @Override - public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) - { - if (modelID == model) - { - TProxyClient.renderStandardInvBlock(renderer, block, metadata); - } - } - - @Override - public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) - { - if (modelID == model) - { - int metadata = world.getBlockMetadata(x, y, z); - if (metadata == 0) - { - renderer.renderStandardBlock(block, x, y, z); - } - else - { - renderRotatedBlock(block, x, y, z, world, renderer); - } - } - return true; - } - - public boolean renderRotatedBlock (Block block, int x, int y, int z, IBlockAccess world, RenderBlocks renderer) - { - IFacingLogic logic = (IFacingLogic) world.getBlockTileEntity(x, y, z); - byte direction = logic.getRenderDirection(); - - if (direction == 0) - { - renderer.uvRotateEast = 3; - renderer.uvRotateWest = 3; - renderer.uvRotateNorth = 3; - renderer.uvRotateSouth = 3; - } - if (direction == 2) - { - renderer.uvRotateNorth = 2; - renderer.uvRotateSouth = 1; - } - if (direction == 3) - { - renderer.uvRotateNorth = 1; - renderer.uvRotateSouth = 2; - renderer.uvRotateTop = 3; - renderer.uvRotateBottom = 3; - } - if (direction == 4) - { - renderer.uvRotateEast = 1; - renderer.uvRotateWest = 2; - renderer.uvRotateTop = 2; - renderer.uvRotateBottom = 1; - } - if (direction == 5) - { - renderer.uvRotateEast = 2; - renderer.uvRotateWest = 1; - renderer.uvRotateTop = 1; - renderer.uvRotateBottom = 2; - } - - boolean flag = renderer.renderStandardBlock(block, x, y, z); - renderer.uvRotateSouth = 0; - renderer.uvRotateEast = 0; - renderer.uvRotateWest = 0; - renderer.uvRotateNorth = 0; - renderer.uvRotateTop = 0; - renderer.uvRotateBottom = 0; - return flag; - } - - @Override - public boolean shouldRender3DInInventory () - { - return true; - } - - @Override - public int getRenderId () - { - return model; - } -} diff --git a/src/tconstruct/client/gui/AdvDrawbridgeButton.java b/src/tconstruct/client/gui/AdvDrawbridgeButton.java deleted file mode 100644 index 80707d5a..00000000 --- a/src/tconstruct/client/gui/AdvDrawbridgeButton.java +++ /dev/null @@ -1,160 +0,0 @@ -package tconstruct.client.gui; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.util.ResourceLocation; -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"); - - /** Button width in pixels */ - protected int width; - - /** Button height in pixels */ - protected int height; - - /** 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; - - /** ID for this control. */ - public int id; - - /** True if this control is enabled, false to disable. */ - public boolean enabled; - - /** Hides the button completely if false. */ - public boolean drawButton; - protected boolean field_82253_i; - - public AdvDrawbridgeButton(int par1, int par2, int par3, int par4, int par5, String par6Str) - { - this(par1, par2, par3, par4, par5, 200, 20, par6Str); - } - - 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; - } - - /** - * 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; - - if (!this.enabled) - { - b0 = 0; - } - else if (par1) - { - b0 = 2; - } - - return b0; - } - - /** - * 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; - - 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 deleted file mode 100644 index 9474dc6a..00000000 --- a/src/tconstruct/client/gui/AdvDrawbridgeGui.java +++ /dev/null @@ -1,170 +0,0 @@ -package tconstruct.client.gui; - -import cpw.mods.fml.common.network.PacketDispatcher; -import java.io.*; -import java.util.Iterator; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraft.util.*; -import net.minecraft.world.World; -import org.lwjgl.opengl.GL11; -import tconstruct.blocks.logic.AdvancedDrawbridgeLogic; -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)); - this.inventorySlots = new AdvancedDrawbridgeContainer(player.inventory, frypan, this); - player.openContainer = this.inventorySlots; - logic = frypan; - } - - protected void drawGuiContainerForegroundLayer (int par1, int par2) - { - fontRenderer.drawString("Advanced Drawbridge", 8, 6, 0x404040); - fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040); - } - - private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/drawbridgeAdvanced.png"); - - protected void drawGuiContainerBackgroundLayer (float f, int i, int j) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(background); - 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); - } - } - - public void initGui () - { - super.initGui(); - int cornerX = (this.width - this.xSize) / 2; - int cornerY = (this.height - this.ySize) / 2; - - this.setExpanded(false); - this.buttonList.clear(); - GuiButton button = new DrawbridgeButton(0, cornerX + 131, cornerY + 18, 176, 0, 21, 22); - if (logic.getPlacementDirection() == 0) - button.enabled = false; - this.buttonList.add(button); - button = new DrawbridgeButton(1, cornerX + 146, cornerY + 34, 199, 23, 22, 21); - if (logic.getPlacementDirection() == 1) - button.enabled = false; - this.buttonList.add(button); - button = new DrawbridgeButton(2, cornerX + 132, cornerY + 48, 199, 0, 21, 22); - if (logic.getPlacementDirection() == 2) - button.enabled = false; - this.buttonList.add(button); - button = new DrawbridgeButton(3, cornerX + 117, cornerY + 34, 178, 23, 22, 21); - if (logic.getPlacementDirection() == 3) - button.enabled = false; - this.buttonList.add(button); - button = new DrawbridgeButton(4, cornerX + 135, cornerY + 40, 217, 0, 10, 10); - 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(); - } - - protected void actionPerformed (GuiButton button) - { - if (button.id == 5) - { - setExpanded(!isGuiExpanded); - return; - } - - for (Object o : buttonList) - { - GuiButton b = (GuiButton) o; - b.enabled = true; - } - button.enabled = false; - - logic.setPlacementDirection((byte) button.id); - updateServer((byte) button.id); - } - - void updateServer (byte direction) - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(8); - DataOutputStream outputStream = new DataOutputStream(bos); - try - { - outputStream.writeByte(5); - outputStream.writeInt(logic.worldObj.provider.dimensionId); - outputStream.writeInt(logic.xCoord); - outputStream.writeInt(logic.yCoord); - outputStream.writeInt(logic.zCoord); - outputStream.writeByte(direction); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - Packet250CustomPayload packet = new Packet250CustomPayload(); - packet.channel = "TConstruct"; - packet.data = bos.toByteArray(); - packet.length = bos.size(); - - PacketDispatcher.sendPacketToServer(packet); - } - - @Override - public void updateScreen () - { - super.updateScreen(); - this.containerNeglectMouse = false; - } -} diff --git a/src/tconstruct/client/gui/DrawbridgeButton.java b/src/tconstruct/client/gui/DrawbridgeButton.java deleted file mode 100644 index 21d9e69c..00000000 --- a/src/tconstruct/client/gui/DrawbridgeButton.java +++ /dev/null @@ -1,49 +0,0 @@ -package tconstruct.client.gui; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class DrawbridgeButton extends GuiButton -{ - /** - * True for pointing right (next page), false for pointing left (previous page). - */ - int uPos; - int vPos; - - public DrawbridgeButton(int id, int xPos, int yPos, int u, int v, int xSize, int ySize) - { - super(id, xPos, yPos, xSize, ySize, ""); - uPos = u; - vPos = v; - } - - private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/drawbridge.png"); - - /** - * Draws this button to the screen. - */ - public void drawButton (Minecraft mc, int par2, int par3) - { - if (this.drawButton) - { - boolean hovering = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - mc.getTextureManager().bindTexture(background); - int offset = 0; - if (!this.enabled) - offset = 46; - else if (hovering) - offset = 92; - - this.drawTexturedModalRect(this.xPosition, this.yPosition, uPos, vPos + offset, width, height); - } - } -} diff --git a/src/tconstruct/client/gui/DrawbridgeGui.java b/src/tconstruct/client/gui/DrawbridgeGui.java deleted file mode 100644 index 65835819..00000000 --- a/src/tconstruct/client/gui/DrawbridgeGui.java +++ /dev/null @@ -1,114 +0,0 @@ -package tconstruct.client.gui; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; -import net.minecraft.world.World; - -import org.lwjgl.opengl.GL11; - -import tconstruct.blocks.logic.DrawbridgeLogic; -import cpw.mods.fml.common.network.PacketDispatcher; - -public class DrawbridgeGui extends GuiContainer -{ - public DrawbridgeLogic logic; - - public DrawbridgeGui(InventoryPlayer inventoryplayer, DrawbridgeLogic frypan, World world, int x, int y, int z) - { - super(frypan.getGuiContainer(inventoryplayer, world, x, y, z)); - logic = frypan; - } - - protected void drawGuiContainerForegroundLayer (int par1, int par2) - { - //fontRenderer.drawString(StatCollector.translateToLocal("aggregator.glowstone"), 60, 6, 0x404040); - fontRenderer.drawString("Drawbridge", 8, 6, 0x404040); - fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040); - } - - private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/drawbridge.png"); - - protected void drawGuiContainerBackgroundLayer (float f, int i, int j) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(background); - int cornerX = (width - xSize) / 2; - int cornerY = (height - ySize) / 2; - drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize); - } - - public void initGui () - { - super.initGui(); - int cornerX = (this.width - this.xSize) / 2; - int cornerY = (this.height - this.ySize) / 2; - - this.buttonList.clear(); - GuiButton button = new DrawbridgeButton(0, cornerX + 131, cornerY + 18, 176, 0, 21, 22); - if (logic.getPlacementDirection() == 0) - button.enabled = false; - this.buttonList.add(button); - button = new DrawbridgeButton(1, cornerX + 146, cornerY + 34, 199, 23, 22, 21); - if (logic.getPlacementDirection() == 1) - button.enabled = false; - this.buttonList.add(button); - button = new DrawbridgeButton(2, cornerX + 132, cornerY + 48, 199, 0, 21, 22); - if (logic.getPlacementDirection() == 2) - button.enabled = false; - this.buttonList.add(button); - button = new DrawbridgeButton(3, cornerX + 117, cornerY + 34, 178, 23, 22, 21); - if (logic.getPlacementDirection() == 3) - button.enabled = false; - this.buttonList.add(button); - button = new DrawbridgeButton(4, cornerX + 135, cornerY + 40, 217, 0, 10, 10); - if (logic.getPlacementDirection() == 4) - button.enabled = false; - this.buttonList.add(button); - } - - protected void actionPerformed (GuiButton button) - { - for (Object o : buttonList) - { - GuiButton b = (GuiButton) o; - b.enabled = true; - } - button.enabled = false; - - logic.setPlacementDirection((byte) button.id); - updateServer((byte) button.id); - } - - void updateServer (byte direction) - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(8); - DataOutputStream outputStream = new DataOutputStream(bos); - try - { - outputStream.writeByte(5); - outputStream.writeInt(logic.worldObj.provider.dimensionId); - outputStream.writeInt(logic.xCoord); - outputStream.writeInt(logic.yCoord); - outputStream.writeInt(logic.zCoord); - outputStream.writeByte(direction); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - - Packet250CustomPayload packet = new Packet250CustomPayload(); - packet.channel = "TConstruct"; - packet.data = bos.toByteArray(); - packet.length = bos.size(); - - PacketDispatcher.sendPacketToServer(packet); - } -} diff --git a/src/tconstruct/common/TContent.java b/src/tconstruct/common/TContent.java index 13b4bcc6..1c98de87 100644 --- a/src/tconstruct/common/TContent.java +++ b/src/tconstruct/common/TContent.java @@ -141,7 +141,6 @@ public class TContent implements IFuelHandler public static Block metalBlock; public static Block tankAir; - public static Block redstoneMachine; public static Block dryingRack; //Decoration @@ -412,13 +411,6 @@ public class TContent implements IFuelHandler GameRegistry.registerBlock(tankAir, "TankAir"); GameRegistry.registerTileEntity(TankAirLogic.class, "tconstruct.tank.air"); - //Redstone machines - redstoneMachine = new RedstoneMachine(PHConstruct.redstoneMachine).setUnlocalizedName("Redstone.Machine"); - GameRegistry.registerBlock(redstoneMachine, RedstoneMachineItem.class, "Redstone.Machine"); - GameRegistry.registerTileEntity(DrawbridgeLogic.class, "Drawbridge"); - GameRegistry.registerTileEntity(FirestarterLogic.class, "Firestarter"); - GameRegistry.registerTileEntity(AdvancedDrawbridgeLogic.class, "AdvDrawbridge"); - //Traps landmine = new BlockLandmine(PHConstruct.landmine).setHardness(0.5F).setResistance(0F).setStepSound(Block.soundMetalFootstep).setCreativeTab(CreativeTabs.tabRedstone) .setUnlocalizedName("landmine"); @@ -1125,22 +1117,6 @@ public class TContent implements IFuelHandler toolForgeBlocks[sc])); } - // Drawbridge Recipes - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(redstoneMachine, 1, 0), "aca", "#d#", "#r#", '#', "ingotBronze", 'a', "ingotAluminumBrass", 'c', new ItemStack(blankPattern, 1, 1), - 'r', new ItemStack(Item.redstone), 'd', new ItemStack(Block.dispenser))); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(redstoneMachine, 1, 0), "aca", "#d#", "#r#", '#', "ingotBronze", 'a', "ingotAluminumBrass", 'c', new ItemStack(blankPattern, 1, 2), - 'r', new ItemStack(Item.redstone), 'd', new ItemStack(Block.dispenser))); - - // Igniter Recipes - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(redstoneMachine, 1, 1), "aca", "#d#", "#r#", '#', "ingotBronze", 'a', "ingotAluminumBrass", 'c', new ItemStack(largePlate, 1, 7), 'r', - new ItemStack(Item.redstone), 'd', new ItemStack(Item.flintAndSteel))); - - // Advanced Drawbridge Recipes - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(redstoneMachine, 1, 2), " c ", "rdr", " a ", 'a', "ingotAluminumBrass", 'c', new ItemStack(blankPattern, 1, 1), 'r', new ItemStack( - Item.redstone), 'd', new ItemStack(redstoneMachine, 1, 0))); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(redstoneMachine, 1, 2), " c ", "rdr", " a ", 'a', "ingotAluminumBrass", 'c', new ItemStack(blankPattern, 1, 2), 'r', new ItemStack( - Item.redstone), 'd', new ItemStack(redstoneMachine, 1, 0))); - // ToolStation Recipes (Wooden Version) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(toolStationWood, 1, 0), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "crafterWood")); GameRegistry.addRecipe(new ItemStack(toolStationWood, 1, 0), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(craftingStationWood, 1, 0)); diff --git a/src/tconstruct/common/TProxyCommon.java b/src/tconstruct/common/TProxyCommon.java index cc858a99..f8ec6605 100644 --- a/src/tconstruct/common/TProxyCommon.java +++ b/src/tconstruct/common/TProxyCommon.java @@ -28,10 +28,10 @@ public class TProxyCommon implements IGuiHandler public static int smelteryGuiID = 7; public static int furnaceID = 8; - public static int drawbridgeID = 9; +// public static int drawbridgeID = 9; // Moved to TMechworks public static int landmineID = 10; public static int craftingStationID = 11; - public static int advDrawbridgeID = 12; +// public static int advDrawbridgeID = 12; // Moved to TMechworks public static int inventoryGui = 100; public static int armorGuiID = 101; public static int knapsackGuiID = 102; diff --git a/src/tconstruct/inventory/AdvancedDrawbridgeContainer.java b/src/tconstruct/inventory/AdvancedDrawbridgeContainer.java deleted file mode 100644 index c2bdc3ea..00000000 --- a/src/tconstruct/inventory/AdvancedDrawbridgeContainer.java +++ /dev/null @@ -1,171 +0,0 @@ -package tconstruct.inventory; - -import net.minecraft.entity.player.EntityPlayer; - -import java.util.Iterator; -import net.minecraft.entity.player.*; -import net.minecraft.inventory.*; -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; - - private AdvDrawbridgeGui gui = null; - - public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic) - { - this.logic = logic; - - addContainerSlots(logic); - bindPlayerInventory(inventoryplayer); - updateContainerSlots(); - } - - public AdvancedDrawbridgeContainer(InventoryPlayer inventoryplayer, AdvancedDrawbridgeLogic logic, AdvDrawbridgeGui gui) - { - this.logic = logic; - this.gui = gui; - - 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)); - } - } - - 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)); - - 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 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 (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(); - } - } - - 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); - } - } -} diff --git a/src/tconstruct/inventory/DrawbridgeContainer.java b/src/tconstruct/inventory/DrawbridgeContainer.java deleted file mode 100644 index 4bd7a9c9..00000000 --- a/src/tconstruct/inventory/DrawbridgeContainer.java +++ /dev/null @@ -1,80 +0,0 @@ -package tconstruct.inventory; - -import tconstruct.blocks.logic.DrawbridgeLogic; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class DrawbridgeContainer extends Container -{ - public DrawbridgeLogic logic; - public int progress = 0; - public int fuel = 0; - public int fuelGague = 0; - - public DrawbridgeContainer(InventoryPlayer inventoryplayer, DrawbridgeLogic logic) - { - this.logic = logic; - - this.addSlotToContainer(new DrawbridgeSlot(logic, 0, 80, 36, logic)); - this.addSlotToContainer(new SlotOpaqueBlocksOnly(logic, 1, 35, 36)); - - /* Player inventory */ - 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)); - } - } - - @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); - - 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 (slotStack.stackSize == 0) - { - slot.putStack((ItemStack) null); - } - else - { - slot.onSlotChanged(); - } - } - - return stack; - } -} diff --git a/src/tconstruct/inventory/DrawbridgeSlot.java b/src/tconstruct/inventory/DrawbridgeSlot.java deleted file mode 100644 index 13595cfc..00000000 --- a/src/tconstruct/inventory/DrawbridgeSlot.java +++ /dev/null @@ -1,47 +0,0 @@ -package tconstruct.inventory; - -import tconstruct.library.blocks.IDrawbridgeLogicBase; - -import tconstruct.blocks.logic.DrawbridgeLogic; -import tconstruct.library.TConstructRegistry; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; - -public class DrawbridgeSlot extends SlotBlocksOnly -{ - IDrawbridgeLogicBase logic; - - public DrawbridgeSlot(IInventory iinventory, int par2, int par3, int par4, IDrawbridgeLogicBase logic) - { - super(iinventory, par2, par3, par4); - this.logic = logic; - } - - @Override - public boolean isItemValid (ItemStack par1ItemStack) - { - if (!super.isItemValid(par1ItemStack)) - { - if (TConstructRegistry.blockToItemMapping[par1ItemStack.itemID] == 0) - { - return false; - } - } - - return !logic.hasExtended(); - } - - @Override - public boolean canTakeStack (EntityPlayer par1EntityPlayer) - { - return !logic.hasExtended(); - } - - @Override - public int getSlotStackLimit () - { - return inventory.getInventoryStackLimit(); - } -} diff --git a/src/tconstruct/items/blocks/RedstoneMachineItem.java b/src/tconstruct/items/blocks/RedstoneMachineItem.java deleted file mode 100644 index dd7faa6e..00000000 --- a/src/tconstruct/items/blocks/RedstoneMachineItem.java +++ /dev/null @@ -1,75 +0,0 @@ -package tconstruct.items.blocks; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.MathHelper; - -public class RedstoneMachineItem extends ItemBlock -{ - public static final String blockType[] = { "drawbridge", "firestarter", "advdrawbridge" }; - - public RedstoneMachineItem(int id) - { - super(id); - setMaxDamage(0); - setHasSubtypes(true); - } - - public int getMetadata (int meta) - { - return meta; - } - - public String getUnlocalizedName (ItemStack itemstack) - { - int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1); - return (new StringBuilder()).append("block.").append(blockType[pos]).toString(); - } - - @Override - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - if (stack.hasTagCompound() && stack.getItemDamage() == 0) - { - NBTTagCompound contentTags = stack.getTagCompound().getCompoundTag("Contents"); - if (contentTags != null) - { - ItemStack contents = ItemStack.loadItemStackFromNBT(contentTags); - if (contents != null) - { - list.add("Inventory: " + contents.getDisplayName()); - list.add("Amount: " + contents.stackSize); - } - } - NBTTagCompound camoTag = stack.getTagCompound().getCompoundTag("Camoflauge"); - if (camoTag != null) - { - ItemStack camo = ItemStack.loadItemStackFromNBT(camoTag); - if (camo != null) - list.add("Camoflauge: " + camo.getDisplayName()); - } - - if (stack.getTagCompound().hasKey("Placement")) - { - String string = getDirectionString(stack.getTagCompound().getByte("Placement")); - list.add("Placement Direction: " + string); - } - } - } - - String getDirectionString (byte key) - { - if (key == 0) - return ("Up"); - if (key == 1) - return ("Right"); - if (key == 2) - return ("Down"); - - return "Left"; - } -} diff --git a/src/tconstruct/util/config/PHConstruct.java b/src/tconstruct/util/config/PHConstruct.java index 1b7322c3..34b69993 100644 --- a/src/tconstruct/util/config/PHConstruct.java +++ b/src/tconstruct/util/config/PHConstruct.java @@ -131,12 +131,12 @@ public class PHConstruct moltenEnder = config.getBlock("Molten Ender", 3218).getInt(3218); - signalBus = config.getBlock("Signal Bus", 3221).getInt(3221); - signalTerminal = config.getBlock("Signal Terminal", 3222).getInt(3222); +// signalBus = config.getBlock("Signal Bus", 3221).getInt(3221); +// signalTerminal = config.getBlock("Signal Terminal", 3222).getInt(3222); glass = config.getBlock("Clear Glass", 3223).getInt(3223); stainedGlass = config.getBlock("Stained Glass", 3224).getInt(3224); stainedGlassClear = config.getBlock("Clear Stained Glass", 3225).getInt(3225); - redstoneMachine = config.getBlock("Redstone Machines", 3226).getInt(3226); +// redstoneMachine = config.getBlock("Redstone Machines", 3226).getInt(3226); // Migrated to TMechworks dryingRack = config.getBlock("Drying Rack", 3227).getInt(3227); glassPane = config.getBlock("Glass Pane", 3228).getInt(3228); stainedGlassClearPane = config.getBlock("Clear Stained Glass Pane", 3229).getInt(3229); @@ -260,8 +260,8 @@ public class PHConstruct goldHead = config.getItem("Patterns and Misc", "Golden Head", 14113).getInt(14113); jerky = config.getItem("Patterns and Misc", "Jerky", 14115).getInt(14115); - spoolWire = config.getItem("Logic", "SpoolWire", 14120).getInt(14120); - lengthWire = config.getItem("Logic", "LengthWire", 14121).getInt(14121); +// spoolWire = config.getItem("Logic", "SpoolWire", 14120).getInt(14120); +// lengthWire = config.getItem("Logic", "LengthWire", 14121).getInt(14121); boolean ic2 = true; boolean xycraft = true; @@ -413,8 +413,8 @@ public class PHConstruct public static int woodenRail; - public static int signalBus; - public static int signalTerminal; +// public static int signalBus; +// public static int signalTerminal; //Crops public static int oreBerry; @@ -580,8 +580,8 @@ public class PHConstruct public static int heartCanister; - public static int spoolWire; - public static int lengthWire; +// public static int spoolWire; +// public static int lengthWire; //Ore values public static boolean generateCopper; diff --git a/src/tconstruct/util/network/TPacketHandler.java b/src/tconstruct/util/network/TPacketHandler.java index 00db4e71..5a331a9c 100644 --- a/src/tconstruct/util/network/TPacketHandler.java +++ b/src/tconstruct/util/network/TPacketHandler.java @@ -15,7 +15,6 @@ import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fluids.FluidStack; import tconstruct.TConstruct; -import tconstruct.blocks.logic.DrawbridgeLogic; import tconstruct.blocks.logic.SmelteryLogic; import tconstruct.blocks.logic.ToolForgeLogic; import tconstruct.blocks.logic.ToolStationLogic; @@ -124,22 +123,6 @@ public class TPacketHandler implements IPacketHandler } } - else if (packetID == 5) //Drawbridge - { - int dimension = inputStream.readInt(); - World world = DimensionManager.getWorld(dimension); - int x = inputStream.readInt(); - int y = inputStream.readInt(); - int z = inputStream.readInt(); - TileEntity te = world.getBlockTileEntity(x, y, z); - - byte direction = inputStream.readByte(); - if (te instanceof DrawbridgeLogic) - { - ((DrawbridgeLogic) te).setPlacementDirection(direction); - } - } - else if (packetID == 10) //Double jump { //String user = inputStream.readUTF(); diff --git a/src/tconstruct/util/player/FakePlayerLogic.java b/src/tconstruct/util/player/FakePlayerLogic.java deleted file mode 100644 index bcc9e76b..00000000 --- a/src/tconstruct/util/player/FakePlayerLogic.java +++ /dev/null @@ -1,22 +0,0 @@ -package tconstruct.util.player; - -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.world.World; -import net.minecraftforge.common.FakePlayer; -import tconstruct.library.blocks.InventoryLogic; - -public class FakePlayerLogic extends FakePlayer -{ - InventoryLogic logic; - - public FakePlayerLogic(World world, String name, InventoryLogic logic) - { - super(world, name); - this.logic = logic; - } - - public ChunkCoordinates getPlayerCoordinates () - { - return new ChunkCoordinates(logic.xCoord, logic.yCoord, logic.zCoord); - } -}