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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/minecraft/assemblyline/client/render/RenderCrate.java b/src/minecraft/assemblyline/client/render/RenderCrate.java
index c13803e2..a665b514 100644
--- a/src/minecraft/assemblyline/client/render/RenderCrate.java
+++ b/src/minecraft/assemblyline/client/render/RenderCrate.java
@@ -7,7 +7,6 @@ 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;
@@ -18,8 +17,9 @@ import net.minecraftforge.common.ForgeDirection;
import org.lwjgl.opengl.GL11;
import assemblyline.common.block.TileEntityCrate;
+import assemblyline.common.machine.imprinter.ItemImprinter;
-public class RenderCrate extends TileEntitySpecialRenderer
+public class RenderCrate extends RenderImprintable
{
private final RenderBlocks renderBlocks = new RenderBlocks();
@@ -37,6 +37,14 @@ public class RenderCrate extends TileEntitySpecialRenderer
String amount = "";
ItemStack itemStack = tileEntity.getStackInSlot(0);
+ if (itemStack == null)
+ {
+ if (tileEntity.getFilter() != null)
+ {
+ 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/client/render/RenderHelper.java b/src/minecraft/assemblyline/client/render/RenderHelper.java
index a79c9bb2..7bdad16f 100644
--- a/src/minecraft/assemblyline/client/render/RenderHelper.java
+++ b/src/minecraft/assemblyline/client/render/RenderHelper.java
@@ -26,6 +26,7 @@ public class RenderHelper
RenderManager renderManager = RenderManager.instance;
FontRenderer fontRenderer = renderManager.getFontRenderer();
float scale = 0.027f;
+ GL11.glColor4f(1f, 1f, 1f, 0.5f);
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.0F, (float) y + 2.3F, (float) z);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
@@ -50,6 +51,7 @@ public class RenderHelper
tessellator.addVertex((double) (stringMiddle + 1), (double) (-1 + yOffset), 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glColor4f(1f, 1f, 1f, 0.5f);
fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
diff --git a/src/minecraft/assemblyline/common/block/BlockCrate.java b/src/minecraft/assemblyline/common/block/BlockCrate.java
index ffc7603c..8381f129 100644
--- a/src/minecraft/assemblyline/common/block/BlockCrate.java
+++ b/src/minecraft/assemblyline/common/block/BlockCrate.java
@@ -5,14 +5,16 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.UETab;
+import assemblyline.api.IFilterable;
import assemblyline.common.AssemblyLine;
+import assemblyline.common.machine.imprinter.ItemImprinter;
/**
- * A block that allows the placement of mass amount of a specific item within it. It will be allowed
- * to go on Conveyor Belts
+ * A block that allows the placement of mass amount of a specific item within it. It will be allowed to go on Conveyor Belts
*
* @author Calclavia
*
@@ -37,6 +39,43 @@ public class BlockCrate extends BlockMachine
{
TileEntityCrate tileEntity = (TileEntityCrate) world.getBlockTileEntity(x, y, z);
+ if (side == ForgeDirection.UP.ordinal())
+ {
+ if (tileEntity != null)
+ {
+ if (tileEntity instanceof IFilterable)
+ {
+ ItemStack containingStack = ((IFilterable) tileEntity).getFilter();
+
+ if (containingStack != null)
+ {
+ if (!world.isRemote)
+ {
+ EntityItem dropStack = new EntityItem(world, player.posX, player.posY, player.posZ, containingStack);
+ dropStack.delayBeforeCanPickup = 0;
+ world.spawnEntityInWorld(dropStack);
+ }
+
+ ((IFilterable) tileEntity).setFilter(null);
+ return true;
+ }
+ else
+ {
+ if (player.getCurrentEquippedItem() != null)
+ {
+ if (player.getCurrentEquippedItem().getItem() instanceof ItemImprinter)
+ {
+ ((IFilterable) tileEntity).setFilter(player.getCurrentEquippedItem());
+ player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
+ return true;
+ }
+ }
+ }
+
+ }
+ }
+ }
+
if (side > 1 && hitY > 0.7)
{
return this.insertAllItems(tileEntity, player);
@@ -163,7 +202,12 @@ public class BlockCrate extends BlockMachine
if (containingStack != null)
{
- if (containingStack.isStackable() && containingStack.isItemEqual(itemStack))
+ boolean filterValid = true;
+ if (tileEntity.getFilter() != null)
+ {
+ filterValid = itemStack.isItemEqual(ItemImprinter.getFilters(tileEntity.getFilter()).get(0));
+ }
+ if (containingStack.isStackable() && containingStack.isItemEqual(itemStack) && filterValid)
{
int newStackSize = containingStack.stackSize + itemStack.stackSize;
int overFlowAmount = newStackSize - tileEntity.getInventoryStackLimit();
@@ -183,8 +227,16 @@ public class BlockCrate extends BlockMachine
}
else
{
- tileEntity.setInventorySlotContents(0, itemStack.copy());
- itemStack.stackSize = 0;
+ boolean filterValid = true;
+ if (tileEntity.getFilter() != null)
+ {
+ filterValid = itemStack.isItemEqual(ItemImprinter.getFilters(tileEntity.getFilter()).get(0));
+ }
+ if (filterValid)
+ {
+ tileEntity.setInventorySlotContents(0, itemStack.copy());
+ itemStack.stackSize = 0;
+ }
}
if (itemStack.stackSize <= 0) { return null; }
@@ -211,10 +263,7 @@ public class BlockCrate extends BlockMachine
{
return this.ejectItems(tileEntity, player, TileEntityCrate.MAX_LIMIT);
}
- else
- {
- return this.ejectItems(tileEntity, player, 64);
- }
+ else if (side != ForgeDirection.UP.ordinal()) { return this.ejectItems(tileEntity, player, 64); }
}
}
diff --git a/src/minecraft/assemblyline/common/block/TileEntityCrate.java b/src/minecraft/assemblyline/common/block/TileEntityCrate.java
index 747e1136..df9fa198 100644
--- a/src/minecraft/assemblyline/common/block/TileEntityCrate.java
+++ b/src/minecraft/assemblyline/common/block/TileEntityCrate.java
@@ -4,19 +4,13 @@ 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.TileEntityImprintable;
-import com.google.common.io.ByteArrayDataInput;
-
-public class TileEntityCrate extends TileEntityAdvanced implements ISidedInventory, IPacketReceiver
+public class TileEntityCrate extends TileEntityImprintable implements ISidedInventory, IPacketReceiver
{
public static final int MAX_LIMIT = 2048;
private ItemStack[] containingItems = new ItemStack[1];
@@ -27,7 +21,7 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento
return false;
}
- @Override
+ /*@Override
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
{
if (this.worldObj.isRemote)
@@ -57,14 +51,14 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento
e.printStackTrace();
}
}
- }
+ }*/
- @Override
+ /*@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.
@@ -124,23 +118,23 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento
}
@Override
- public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
+ public void setInventorySlotContents(int slot, ItemStack stack)
{
- if (par2ItemStack != null)
+ if (stack != null)
{
- if (par2ItemStack.isStackable())
+ if (stack.isStackable())
{
- this.containingItems[par1] = par2ItemStack;
+ this.containingItems[slot] = stack;
- if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
+ if (stack != null && stack.stackSize > this.getInventoryStackLimit())
{
- par2ItemStack.stackSize = this.getInventoryStackLimit();
+ stack.stackSize = this.getInventoryStackLimit();
}
}
}
else
{
- this.containingItems[par1] = null;
+ this.containingItems[slot] = null;
}
if (!this.worldObj.isRemote)
diff --git a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java
index 5df1dd14..3c3c820e 100644
--- a/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java
+++ b/src/minecraft/assemblyline/common/machine/TileEntityManipulator.java
@@ -467,10 +467,4 @@ public class TileEntityManipulator extends TileEntityImprintable implements IRed
{
this.isRedstonePowered = false;
}
-
- @Override
- public String getInvName()
- {
- return TranslationHelper.getLocal("tile.manipulator.name");
- }
}
diff --git a/src/minecraft/assemblyline/common/machine/TileEntityRejector.java b/src/minecraft/assemblyline/common/machine/TileEntityRejector.java
index cdb21fe3..e889032f 100644
--- a/src/minecraft/assemblyline/common/machine/TileEntityRejector.java
+++ b/src/minecraft/assemblyline/common/machine/TileEntityRejector.java
@@ -131,15 +131,6 @@ public class TileEntityRejector extends TileEntityImprintable
return false;
}
- /**
- * Inventory Methods
- */
- @Override
- public String getInvName()
- {
- return TranslationHelper.getLocal("tile.rejector.name");
- }
-
/**
* UE methods
*/
diff --git a/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java b/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java
index 0ead62b8..3e491ae6 100644
--- a/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java
+++ b/src/minecraft/assemblyline/common/machine/detector/TileEntityDetector.java
@@ -122,10 +122,4 @@ public class TileEntityDetector extends TileEntityImprintable
{
return this.isPoweringTo(side);
}
-
- @Override
- public String getInvName()
- {
- return "Detector";
- }
}
diff --git a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprintable.java b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprintable.java
index 4c4fdaf4..d5eeba99 100644
--- a/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprintable.java
+++ b/src/minecraft/assemblyline/common/machine/imprinter/TileEntityImprintable.java
@@ -26,7 +26,7 @@ import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
-public abstract class TileEntityImprintable extends TileEntityAssemblyNetwork implements IRotatable, IFilterable, IPacketReceiver, IInventory
+public abstract class TileEntityImprintable extends TileEntityAssemblyNetwork implements IRotatable, IFilterable, IPacketReceiver
{
private ItemStack filterItem;
private boolean inverted;
@@ -57,100 +57,10 @@ public abstract class TileEntityImprintable extends TileEntityAssemblyNetwork im
return inverted;
}
- @Override
- public int getSizeInventory()
- {
- return 1;
- }
-
- @Override
- public ItemStack getStackInSlot(int slot)
- {
- if (slot == 0)
- return this.filterItem;
- else
- return null;
- }
-
- @Override
- public ItemStack decrStackSize(int slot, int amount)
- {
- if (this.filterItem != null)
- {
- ItemStack stack;
-
- if (this.filterItem.stackSize <= amount)
- {
- stack = this.filterItem;
- filterItem = null;
- return stack;
- }
- else
- {
- stack = this.filterItem.splitStack(amount);
-
- if (this.filterItem.stackSize == 0)
- {
- this.filterItem = null;
- }
-
- return stack;
- }
- }
- else
- {
- return null;
- }
- }
-
- @Override
- public ItemStack getStackInSlotOnClosing(int slot)
- {
- if (this.filterItem != null)
- {
- ItemStack stack = this.filterItem;
- filterItem = null;
- return stack;
- }
- else
- {
- return null;
- }
- }
-
- @Override
- public void setInventorySlotContents(int slot, ItemStack stack)
- {
- this.filterItem = stack;
-
- if (stack != null && stack.stackSize > this.getInventoryStackLimit())
- {
- stack.stackSize = this.getInventoryStackLimit();
- }
- }
-
- @Override
- public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
- {
- return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D;
- }
-
- @Override
- public void openChest()
- {
-
- }
-
- @Override
- public void closeChest()
- {
-
- }
-
@Override
public void setFilter(ItemStack filter)
{
- this.setInventorySlotContents(0, filter);
+ this.filterItem = filter;
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
{
@@ -161,7 +71,7 @@ public abstract class TileEntityImprintable extends TileEntityAssemblyNetwork im
@Override
public ItemStack getFilter()
{
- return this.getStackInSlot(0);
+ return this.filterItem;
}
public void setInverted(boolean inverted)
@@ -195,12 +105,6 @@ public abstract class TileEntityImprintable extends TileEntityAssemblyNetwork im
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, facingDirection.ordinal());
}
- @Override
- public int getInventoryStackLimit()
- {
- return 1;
- }
-
/**
* Don't override this! Override getPackData() instead!
*/
@@ -262,7 +166,7 @@ public abstract class TileEntityImprintable extends TileEntityAssemblyNetwork im
inverted = nbt.getBoolean("inverted");
NBTTagCompound filter = nbt.getCompoundTag("filter");
- setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(filter));
+ this.filterItem = ItemStack.loadItemStackFromNBT(filter);
}
}