From 965ec49b16d2de9010adf25538ba29e323913112 Mon Sep 17 00:00:00 2001 From: Robert S Date: Tue, 27 May 2014 03:28:31 -0400 Subject: [PATCH] Changed crates to place items into player's inventory vs dropping them on the floor --- .../archaic/crate/BlockCrate.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/archaic/src/main/scala/resonantinduction/archaic/crate/BlockCrate.java b/archaic/src/main/scala/resonantinduction/archaic/crate/BlockCrate.java index dc6f2447..5a997688 100644 --- a/archaic/src/main/scala/resonantinduction/archaic/crate/BlockCrate.java +++ b/archaic/src/main/scala/resonantinduction/archaic/crate/BlockCrate.java @@ -150,16 +150,16 @@ public class BlockCrate extends BlockTile } else if (hitY <= 0.5) { - tryEject(tile, player, System.currentTimeMillis() - tile.prevClickTime < 10); + tryEject(tile, player, System.currentTimeMillis() - tile.prevClickTime < 250); } else { - tryInsert(tile, player, System.currentTimeMillis() - tile.prevClickTime < 10); + tryInsert(tile, player, System.currentTimeMillis() - tile.prevClickTime < 250); } } 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) { int amountToTake = Math.min(slotStack.stackSize, requestSize); - ItemStack dropStack = slotStack.copy(); - dropStack.stackSize = amountToTake; + dropStack.stackSize = amountToTake; - EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, dropStack); - entityItem.delayBeforeCanPickup = 0; - world.spawnEntityInWorld(entityItem); - - slotStack.stackSize -= amountToTake; - ammountEjected += amountToTake; - if (slotStack.stackSize <= 0) + if (!player.inventory.addItemStackToInventory(dropStack)) { - slotStack = null; + tileEntity.getInventory().setInventorySlotContents(slot, slotStack); + ammountEjected += amountToTake - slotStack.stackSize; + break; + } + else + { + tileEntity.getInventory().setInventorySlotContents(slot, null); + ammountEjected += amountToTake; } - tileEntity.getInventory().setInventorySlotContents(slot, slotStack); } if (ammountEjected >= requestSize) @@ -342,6 +341,7 @@ public class BlockCrate extends BlockTile return true; } } + player.inventory.onInventoryChanged(); tileEntity.onInventoryChanged(); return true; }