Fixed crates

This commit is contained in:
Henry Mao 2012-12-15 23:29:54 +08:00
parent 481b0d9852
commit 1781a35ae4
5 changed files with 36 additions and 18 deletions

View file

@ -1 +1 @@
22
24

View file

@ -16,4 +16,6 @@ Minecraft 1.4.2
@ AssemblyLine_v0.1.6.19.jar AssemblyLine_v0.1.6.19_api.zip
@ AssemblyLine_v0.1.6.20.jar AssemblyLine_v0.1.6.20_api.zip
@ AssemblyLine_v0.1.6.21.jar AssemblyLine_v0.1.6.21_api.zip
* AssemblyLine_v0.1.6.22.jar AssemblyLine_v0.1.6.22_api.zip
x AssemblyLine_v0.1.6.22.jar AssemblyLine_v0.1.6.22_api.zip
x AssemblyLine_v0.1.6.23.jar AssemblyLine_v0.1.6.23_api.zip
* AssemblyLine_v0.1.6.24.jar AssemblyLine_v0.1.6.24_api.zip

View file

@ -91,6 +91,8 @@ public class BlockCrate extends BlockMachine
ItemStack containingStack = tileEntity.getStackInSlot(0);
if (containingStack != null)
{
if (containingStack.stackSize > 0)
{
int amountToTake = Math.min(containingStack.stackSize, 64);
ItemStack dropStack = containingStack.copy();
@ -106,6 +108,7 @@ public class BlockCrate extends BlockMachine
world.spawnEntityInWorld(entityItem);
containingStack.stackSize -= amountToTake;
}
if (containingStack.stackSize <= 0)
{

View file

@ -122,6 +122,10 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento
@Override
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
if (par2ItemStack != null)
{
if (par2ItemStack.isStackable())
{
this.containingItems[par1] = par2ItemStack;
@ -129,6 +133,12 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento
{
par2ItemStack.stackSize = this.getInventoryStackLimit();
}
}
}
else
{
this.containingItems[par1] = null;
}
if (!this.worldObj.isRemote)
{

View file

@ -276,10 +276,13 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
if (stackInInventory == null)
{
inventory.setInventorySlotContents(slotIndex, itemStack);
if (inventory.getStackInSlot(slotIndex) == null) { return itemStack; }
return null;
}
else if (stackInInventory.isItemEqual(itemStack))
{
stackInInventory = stackInInventory.copy();
int rejectedAmount = Math.max((stackInInventory.stackSize + itemStack.stackSize) - stackInInventory.getItem().getItemStackLimit(), 0);
stackInInventory.stackSize = Math.min(Math.max((stackInInventory.stackSize + itemStack.stackSize - rejectedAmount), 0), stackInInventory.getItem().getItemStackLimit());
itemStack.stackSize = rejectedAmount;