Set the item in the current hand instead of the current slot

Should close #324
This commit is contained in:
Ellpeck 2016-11-17 16:31:05 +01:00
parent 4231bbf557
commit 95ca15cd1a
2 changed files with 3 additions and 3 deletions

View file

@ -88,7 +88,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
else{ else{
ItemStack slot = reconstructor.getStackInSlot(0); ItemStack slot = reconstructor.getStackInSlot(0);
if(StackUtil.isValid(slot)){ if(StackUtil.isValid(slot)){
player.inventory.setInventorySlotContents(player.inventory.currentItem, slot.copy()); player.setHeldItem(hand, slot.copy());
reconstructor.setInventorySlotContents(0, StackUtil.getNull()); reconstructor.setInventorySlotContents(0, StackUtil.getNull());
} }
} }

View file

@ -117,7 +117,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
} }
else{ else{
if(!StackUtil.isValid(stackPlayer)){ if(!StackUtil.isValid(stackPlayer)){
player.inventory.setInventorySlotContents(player.inventory.currentItem, slot.copy()); player.setHeldItem(hand, slot.copy());
compost.setInventorySlotContents(0, null); compost.setInventorySlotContents(0, null);
return true; return true;
} }
@ -125,7 +125,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
int addedStackSize = Math.min(StackUtil.getStackSize(slot), stackPlayer.getMaxStackSize()-StackUtil.getStackSize(stackPlayer)); int addedStackSize = Math.min(StackUtil.getStackSize(slot), stackPlayer.getMaxStackSize()-StackUtil.getStackSize(stackPlayer));
ItemStack stackToAdd = stackPlayer.copy(); ItemStack stackToAdd = stackPlayer.copy();
stackToAdd = StackUtil.addStackSize(stackToAdd, addedStackSize); stackToAdd = StackUtil.addStackSize(stackToAdd, addedStackSize);
player.inventory.setInventorySlotContents(player.inventory.currentItem, stackToAdd); player.setHeldItem(hand, stackToAdd);
compost.decrStackSize(0, addedStackSize); compost.decrStackSize(0, addedStackSize);
return true; return true;