Fixed hand not swinging when putting items in display stands / empowerers in creative mode.

This commit is contained in:
Flanks255 2024-03-04 17:03:33 -06:00
parent b33faa124f
commit 350da9b2b0

View file

@ -72,15 +72,18 @@ public class BlockDisplayStand extends BlockContainerBase {
ItemStack toPut = heldItem.copy(); ItemStack toPut = heldItem.copy();
toPut.setCount(1); toPut.setCount(1);
stand.inv.setStackInSlot(0, toPut); stand.inv.setStackInSlot(0, toPut);
if (!player.isCreative()) { if (!player.isCreative())
heldItem.shrink(1); heldItem.shrink(1);
} else
player.swing(hand, true);
return InteractionResult.CONSUME; return InteractionResult.CONSUME;
} else if (ItemUtil.canBeStacked(heldItem, stackThere)) { } else if (ItemUtil.canBeStacked(heldItem, stackThere)) {
int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount()); int maxTransfer = Math.min(stackThere.getCount(), heldItem.getMaxStackSize() - heldItem.getCount());
if (maxTransfer > 0) { if (maxTransfer > 0) {
if (!player.isCreative()) if (!player.isCreative())
player.setItemInHand(hand, StackUtil.grow(heldItem, maxTransfer)); player.setItemInHand(hand, StackUtil.grow(heldItem, maxTransfer));
else
player.swing(hand, true);
ItemStack newStackThere = stackThere.copy(); ItemStack newStackThere = stackThere.copy();
newStackThere.shrink(maxTransfer); newStackThere.shrink(maxTransfer);
stand.inv.setStackInSlot(0, newStackThere); stand.inv.setStackInSlot(0, newStackThere);