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.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
|
||||
|
|
|
@ -92,20 +92,23 @@ public class BlockCrate extends BlockMachine
|
|||
|
||||
if (containingStack != null)
|
||||
{
|
||||
int amountToTake = Math.min(containingStack.stackSize, 64);
|
||||
ItemStack dropStack = containingStack.copy();
|
||||
dropStack.stackSize = amountToTake;
|
||||
if (containingStack.stackSize > 0)
|
||||
{
|
||||
int amountToTake = Math.min(containingStack.stackSize, 64);
|
||||
ItemStack dropStack = containingStack.copy();
|
||||
dropStack.stackSize = amountToTake;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, par5EntityPlayer.posX, par5EntityPlayer.posY, par5EntityPlayer.posZ, dropStack);
|
||||
EntityItem entityItem = new EntityItem(world, par5EntityPlayer.posX, par5EntityPlayer.posY, par5EntityPlayer.posZ, dropStack);
|
||||
|
||||
float var13 = 0.05F;
|
||||
entityItem.motionX = ((float) world.rand.nextGaussian() * var13);
|
||||
entityItem.motionY = ((float) world.rand.nextGaussian() * var13 + 0.2F);
|
||||
entityItem.motionZ = ((float) world.rand.nextGaussian() * var13);
|
||||
entityItem.delayBeforeCanPickup = 0;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
float var13 = 0.05F;
|
||||
entityItem.motionX = ((float) world.rand.nextGaussian() * var13);
|
||||
entityItem.motionY = ((float) world.rand.nextGaussian() * var13 + 0.2F);
|
||||
entityItem.motionZ = ((float) world.rand.nextGaussian() * var13);
|
||||
entityItem.delayBeforeCanPickup = 0;
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
|
||||
containingStack.stackSize -= amountToTake;
|
||||
containingStack.stackSize -= amountToTake;
|
||||
}
|
||||
|
||||
if (containingStack.stackSize <= 0)
|
||||
{
|
||||
|
|
|
@ -123,11 +123,21 @@ public class TileEntityCrate extends TileEntityAdvanced implements ISidedInvento
|
|||
@Override
|
||||
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
this.containingItems[par1] = par2ItemStack;
|
||||
|
||||
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
|
||||
if (par2ItemStack != null)
|
||||
{
|
||||
par2ItemStack.stackSize = this.getInventoryStackLimit();
|
||||
if (par2ItemStack.isStackable())
|
||||
{
|
||||
this.containingItems[par1] = par2ItemStack;
|
||||
|
||||
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
|
||||
{
|
||||
par2ItemStack.stackSize = this.getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.containingItems[par1] = null;
|
||||
}
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue