Fixed crates
This commit is contained in:
parent
481b0d9852
commit
1781a35ae4
5 changed files with 36 additions and 18 deletions
|
@ -1 +1 @@
|
||||||
22
|
24
|
||||||
|
|
4
info.txt
4
info.txt
|
@ -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.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.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.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
|
||||||
|
|
|
@ -91,6 +91,8 @@ public class BlockCrate extends BlockMachine
|
||||||
ItemStack containingStack = tileEntity.getStackInSlot(0);
|
ItemStack containingStack = tileEntity.getStackInSlot(0);
|
||||||
|
|
||||||
if (containingStack != null)
|
if (containingStack != null)
|
||||||
|
{
|
||||||
|
if (containingStack.stackSize > 0)
|
||||||
{
|
{
|
||||||
int amountToTake = Math.min(containingStack.stackSize, 64);
|
int amountToTake = Math.min(containingStack.stackSize, 64);
|
||||||
ItemStack dropStack = containingStack.copy();
|
ItemStack dropStack = containingStack.copy();
|
||||||
|
@ -106,6 +108,7 @@ public class BlockCrate extends BlockMachine
|
||||||
world.spawnEntityInWorld(entityItem);
|
world.spawnEntityInWorld(entityItem);
|
||||||
|
|
||||||
containingStack.stackSize -= amountToTake;
|
containingStack.stackSize -= amountToTake;
|
||||||
|
}
|
||||||
|
|
||||||
if (containingStack.stackSize <= 0)
|
if (containingStack.stackSize <= 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,6 +122,10 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
|
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
|
||||||
|
{
|
||||||
|
if (par2ItemStack != null)
|
||||||
|
{
|
||||||
|
if (par2ItemStack.isStackable())
|
||||||
{
|
{
|
||||||
this.containingItems[par1] = par2ItemStack;
|
this.containingItems[par1] = par2ItemStack;
|
||||||
|
|
||||||
|
@ -129,6 +133,12 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento
|
||||||
{
|
{
|
||||||
par2ItemStack.stackSize = this.getInventoryStackLimit();
|
par2ItemStack.stackSize = this.getInventoryStackLimit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.containingItems[par1] = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.worldObj.isRemote)
|
if (!this.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
|
|
|
@ -276,10 +276,13 @@ public class TileEntityManipulator extends TileEntityElectricityReceiver impleme
|
||||||
if (stackInInventory == null)
|
if (stackInInventory == null)
|
||||||
{
|
{
|
||||||
inventory.setInventorySlotContents(slotIndex, itemStack);
|
inventory.setInventorySlotContents(slotIndex, itemStack);
|
||||||
|
if (inventory.getStackInSlot(slotIndex) == null) { return itemStack; }
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (stackInInventory.isItemEqual(itemStack))
|
else if (stackInInventory.isItemEqual(itemStack))
|
||||||
{
|
{
|
||||||
|
stackInInventory = stackInInventory.copy();
|
||||||
int rejectedAmount = Math.max((stackInInventory.stackSize + itemStack.stackSize) - stackInInventory.getItem().getItemStackLimit(), 0);
|
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());
|
stackInInventory.stackSize = Math.min(Math.max((stackInInventory.stackSize + itemStack.stackSize - rejectedAmount), 0), stackInInventory.getItem().getItemStackLimit());
|
||||||
itemStack.stackSize = rejectedAmount;
|
itemStack.stackSize = rejectedAmount;
|
||||||
|
|
Loading…
Reference in a new issue