Changed crates to place items into player's inventory vs dropping them on the floor
This commit is contained in:
parent
ab5fdfa34e
commit
965ec49b16
1 changed files with 14 additions and 14 deletions
|
@ -150,16 +150,16 @@ public class BlockCrate extends BlockTile
|
||||||
}
|
}
|
||||||
else if (hitY <= 0.5)
|
else if (hitY <= 0.5)
|
||||||
{
|
{
|
||||||
tryEject(tile, player, System.currentTimeMillis() - tile.prevClickTime < 10);
|
tryEject(tile, player, System.currentTimeMillis() - tile.prevClickTime < 250);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tryInsert(tile, player, System.currentTimeMillis() - tile.prevClickTime < 10);
|
tryInsert(tile, player, System.currentTimeMillis() - tile.prevClickTime < 250);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tryInsert(tile, player, System.currentTimeMillis() - tile.prevClickTime < 10);
|
tryInsert(tile, player, System.currentTimeMillis() - tile.prevClickTime < 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -320,21 +320,20 @@ public class BlockCrate extends BlockTile
|
||||||
if (slotStack != null && slotStack.stackSize > 0)
|
if (slotStack != null && slotStack.stackSize > 0)
|
||||||
{
|
{
|
||||||
int amountToTake = Math.min(slotStack.stackSize, requestSize);
|
int amountToTake = Math.min(slotStack.stackSize, requestSize);
|
||||||
|
|
||||||
ItemStack dropStack = slotStack.copy();
|
ItemStack dropStack = slotStack.copy();
|
||||||
dropStack.stackSize = amountToTake;
|
dropStack.stackSize = amountToTake;
|
||||||
|
|
||||||
EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, dropStack);
|
if (!player.inventory.addItemStackToInventory(dropStack))
|
||||||
entityItem.delayBeforeCanPickup = 0;
|
|
||||||
world.spawnEntityInWorld(entityItem);
|
|
||||||
|
|
||||||
slotStack.stackSize -= amountToTake;
|
|
||||||
ammountEjected += amountToTake;
|
|
||||||
if (slotStack.stackSize <= 0)
|
|
||||||
{
|
{
|
||||||
slotStack = null;
|
|
||||||
}
|
|
||||||
tileEntity.getInventory().setInventorySlotContents(slot, slotStack);
|
tileEntity.getInventory().setInventorySlotContents(slot, slotStack);
|
||||||
|
ammountEjected += amountToTake - slotStack.stackSize;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tileEntity.getInventory().setInventorySlotContents(slot, null);
|
||||||
|
ammountEjected += amountToTake;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (ammountEjected >= requestSize)
|
if (ammountEjected >= requestSize)
|
||||||
|
@ -342,6 +341,7 @@ public class BlockCrate extends BlockTile
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
player.inventory.onInventoryChanged();
|
||||||
tileEntity.onInventoryChanged();
|
tileEntity.onInventoryChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue