mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Fixed hand not swinging when putting items in display stands / empowerers in creative mode.
This commit is contained in:
parent
b33faa124f
commit
350da9b2b0
1 changed files with 5 additions and 2 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue