diff --git a/src/minecraft/assemblyline/client/ClientProxy.java b/src/minecraft/assemblyline/client/ClientProxy.java index c2a2921ca..5591ae82d 100644 --- a/src/minecraft/assemblyline/client/ClientProxy.java +++ b/src/minecraft/assemblyline/client/ClientProxy.java @@ -58,7 +58,7 @@ public class ClientProxy extends CommonProxy return new GuiImprinter(player.inventory, world, new Vector3(x, y, z)); case GUI_ENCODER: if (tileEntity != null && tileEntity instanceof TileEntityEncoder) - return new GuiEncoder(player.inventory, world, (TileEntityEncoder) tileEntity); + return new GuiEncoder(player.inventory, (TileEntityEncoder) tileEntity); } return null; diff --git a/src/minecraft/assemblyline/client/gui/GuiEncoder.java b/src/minecraft/assemblyline/client/gui/GuiEncoder.java index 38bf667d5..4f9964b30 100644 --- a/src/minecraft/assemblyline/client/gui/GuiEncoder.java +++ b/src/minecraft/assemblyline/client/gui/GuiEncoder.java @@ -16,14 +16,10 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; -import cpw.mods.fml.common.network.PacketDispatcher; - -import universalelectricity.core.vector.Vector3; import universalelectricity.prefab.TranslationHelper; import universalelectricity.prefab.network.PacketManager; import assemblyline.common.AssemblyLine; @@ -32,6 +28,7 @@ import assemblyline.common.machine.encoder.ContainerEncoder; import assemblyline.common.machine.encoder.IInventoryWatcher; import assemblyline.common.machine.encoder.ItemDisk; import assemblyline.common.machine.encoder.TileEntityEncoder; +import cpw.mods.fml.common.network.PacketDispatcher; public class GuiEncoder extends GuiContainer implements IInventoryWatcher { @@ -49,9 +46,9 @@ public class GuiEncoder extends GuiContainer implements IInventoryWatcher private GuiButton pDnButton; private GuiTextField commandField; - public GuiEncoder(InventoryPlayer par1InventoryPlayer, World worldObj, TileEntityEncoder tileEntity) + public GuiEncoder(InventoryPlayer par1InventoryPlayer, TileEntityEncoder tileEntity) { - super(new ContainerEncoder(par1InventoryPlayer, worldObj, tileEntity)); + super(new ContainerEncoder(par1InventoryPlayer, tileEntity)); this.ySize = 256; this.tileEntity = tileEntity; } diff --git a/src/minecraft/assemblyline/client/render/RenderCrate.java b/src/minecraft/assemblyline/client/render/RenderCrate.java index 289f8e358..8f5daf1ac 100644 --- a/src/minecraft/assemblyline/client/render/RenderCrate.java +++ b/src/minecraft/assemblyline/client/render/RenderCrate.java @@ -7,6 +7,7 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderEngine; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -19,9 +20,8 @@ import org.lwjgl.opengl.GL11; import assemblyline.common.block.TileEntityCrate; import assemblyline.common.machine.imprinter.ItemImprinter; -public class RenderCrate extends RenderImprintable +public class RenderCrate extends TileEntitySpecialRenderer { - private final RenderBlocks renderBlocks = new RenderBlocks(); @Override @@ -37,23 +37,6 @@ public class RenderCrate extends RenderImprintable String amount = ""; ItemStack itemStack = tileEntity.getStackInSlot(0); - if (itemStack == null) - { - if (tileEntity.getFilter() != null) - { - if (ItemImprinter.getFilters(tileEntity.getFilter()).size() > 0) - { - itemStack = ItemImprinter.getFilters(tileEntity.getFilter()).get(0).splitStack(0); // see - // if - // it - // has - // a - // filter - // instead - } - } - } - if (itemStack != null) { itemName = itemStack.getDisplayName(); diff --git a/src/minecraft/assemblyline/common/CommonProxy.java b/src/minecraft/assemblyline/common/CommonProxy.java index 9619bc272..82de5079f 100644 --- a/src/minecraft/assemblyline/common/CommonProxy.java +++ b/src/minecraft/assemblyline/common/CommonProxy.java @@ -41,8 +41,6 @@ public class CommonProxy implements IGuiHandler { TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - // System.out.println("Server GUI request for ID " + ID); - switch (ID) { case GUI_STAMPER: @@ -50,7 +48,7 @@ public class CommonProxy implements IGuiHandler case GUI_ENCODER: { if (tileEntity != null && tileEntity instanceof TileEntityEncoder) - return new ContainerEncoder(player.inventory, world, (TileEntityEncoder) tileEntity); + return new ContainerEncoder(player.inventory, (TileEntityEncoder) tileEntity); } } diff --git a/src/minecraft/assemblyline/common/block/BlockCrate.java b/src/minecraft/assemblyline/common/block/BlockCrate.java index 299016837..e0a058f75 100644 --- a/src/minecraft/assemblyline/common/block/BlockCrate.java +++ b/src/minecraft/assemblyline/common/block/BlockCrate.java @@ -203,15 +203,7 @@ public class BlockCrate extends BlockMachine if (containingStack != null) { - boolean filterValid = true; - if (tileEntity.getFilter() != null) - { - if (ItemImprinter.getFilters(tileEntity.getFilter()).size() > 0) - { - filterValid = itemStack.isItemEqual(ItemImprinter.getFilters(tileEntity.getFilter()).get(0)); - } - } - if (containingStack.isStackable() && containingStack.isItemEqual(itemStack) && filterValid) + if (containingStack.isStackable() && containingStack.isItemEqual(itemStack)) { int newStackSize = containingStack.stackSize + itemStack.stackSize; int overFlowAmount = newStackSize - tileEntity.getInventoryStackLimit(); @@ -231,19 +223,8 @@ public class BlockCrate extends BlockMachine } else { - boolean filterValid = true; - if (tileEntity.getFilter() != null) - { - if (ItemImprinter.getFilters(tileEntity.getFilter()).size() > 0) - { - filterValid = itemStack.isItemEqual(ItemImprinter.getFilters(tileEntity.getFilter()).get(0)); - } - } - if (filterValid) - { - tileEntity.setInventorySlotContents(0, itemStack.copy()); - itemStack.stackSize = 0; - } + tileEntity.setInventorySlotContents(0, itemStack.copy()); + itemStack.stackSize = 0; } if (itemStack.stackSize <= 0) { return null; } diff --git a/src/minecraft/assemblyline/common/block/TileEntityCrate.java b/src/minecraft/assemblyline/common/block/TileEntityCrate.java index 3ef363d0c..f9a1034b8 100644 --- a/src/minecraft/assemblyline/common/block/TileEntityCrate.java +++ b/src/minecraft/assemblyline/common/block/TileEntityCrate.java @@ -4,16 +4,23 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import net.minecraft.network.INetworkManager; +import net.minecraft.network.packet.Packet; +import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ISidedInventory; import universalelectricity.prefab.network.IPacketReceiver; import universalelectricity.prefab.network.PacketManager; +import universalelectricity.prefab.tile.TileEntityAdvanced; +import assemblyline.common.AssemblyLine; import assemblyline.common.machine.imprinter.ItemImprinter; -import assemblyline.common.machine.imprinter.TileEntityImprintable; + +import com.google.common.io.ByteArrayDataInput; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.relauncher.Side; -public class TileEntityCrate extends TileEntityImprintable implements ISidedInventory, IPacketReceiver +public class TileEntityCrate extends TileEntityAdvanced implements ISidedInventory, IPacketReceiver { public static final int MAX_LIMIT = 2048; private ItemStack[] containingItems = new ItemStack[1]; @@ -24,24 +31,44 @@ public class TileEntityCrate extends TileEntityImprintable implements ISidedInve return false; } - /* - * @Override public void handlePacketData(INetworkManager network, int packetType, - * Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) { if - * (this.worldObj.isRemote) { try { if (dataStream.readBoolean()) { if (this.containingItems[0] - * == null) { this.containingItems[0] = new ItemStack(dataStream.readInt(), - * dataStream.readInt(), dataStream.readInt()); } else { this.containingItems[0].itemID = - * dataStream.readInt(); this.containingItems[0].stackSize = dataStream.readInt(); - * this.containingItems[0].setItemDamage(dataStream.readInt()); } } else { - * this.containingItems[0] = null; } } catch (Exception e) { e.printStackTrace(); } } } - */ + @Override + public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) + { + if (this.worldObj.isRemote) + { + try + { + if (dataStream.readBoolean()) + { + if (this.containingItems[0] == null) + { + this.containingItems[0] = new ItemStack(dataStream.readInt(), dataStream.readInt(), dataStream.readInt()); + } + else + { + this.containingItems[0].itemID = dataStream.readInt(); + this.containingItems[0].stackSize = dataStream.readInt(); + this.containingItems[0].setItemDamage(dataStream.readInt()); + } + } + else + { + this.containingItems[0] = null; + } + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } - /* - * @Override public Packet getDescriptionPacket() { if (this.containingItems[0] != null) { - * return PacketManager.getPacket(AssemblyLine.CHANNEL, this, true, - * this.containingItems[0].itemID, this.containingItems[0].stackSize, - * this.containingItems[0].getItemDamage()); } return - * PacketManager.getPacket(AssemblyLine.CHANNEL, this, false); } - */ + @Override + public Packet getDescriptionPacket() + { + if (this.containingItems[0] != null) { return PacketManager.getPacket(AssemblyLine.CHANNEL, this, true, this.containingItems[0].itemID, this.containingItems[0].stackSize, this.containingItems[0].getItemDamage()); } + return PacketManager.getPacket(AssemblyLine.CHANNEL, this, false); + } /** * Inventory functions. @@ -105,14 +132,6 @@ public class TileEntityCrate extends TileEntityImprintable implements ISidedInve { if (stack != null) { - boolean filterValid = true; - if (getFilter() != null) - { - if (ItemImprinter.getFilters(getFilter()).size() > 0) - { - filterValid = stack.isItemEqual(ItemImprinter.getFilters(getFilter()).get(0)); - } - } if (stack.isStackable()) { this.containingItems[slot] = stack; diff --git a/src/minecraft/assemblyline/common/machine/encoder/ContainerEncoder.java b/src/minecraft/assemblyline/common/machine/encoder/ContainerEncoder.java index 6edbe3e92..0b195cdfa 100644 --- a/src/minecraft/assemblyline/common/machine/encoder/ContainerEncoder.java +++ b/src/minecraft/assemblyline/common/machine/encoder/ContainerEncoder.java @@ -11,19 +11,17 @@ import universalelectricity.core.vector.Vector3; public class ContainerEncoder extends Container { private ItemStack[] containingItems = new ItemStack[1]; - private World worldObj; private InventoryPlayer inventoryPlayer; private TileEntityEncoder encoder; - public ContainerEncoder(InventoryPlayer inventoryPlayer, World worldObj, TileEntityEncoder encoder) + public ContainerEncoder(InventoryPlayer inventoryPlayer, TileEntityEncoder encoder) { - this.worldObj = worldObj; this.inventoryPlayer = inventoryPlayer; this.encoder = encoder; // Disk this.addSlotToContainer(new Slot(encoder, 0, 80, 17)); - + int var3; for (var3 = 0; var3 < 3; ++var3)