Right-click equip should only work if the current equipment is air

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-10-25 11:12:52 +02:00
parent 1851ea7eca
commit c9f52397cb

View File

@ -34,8 +34,10 @@ public class UseItemListener {
final EquipmentSlot equipmentSlot = material.registry().equipmentSlot();
if (equipmentSlot != null) {
final ItemStack currentlyEquipped = playerInventory.getEquipment(equipmentSlot);
playerInventory.setEquipment(equipmentSlot, itemStack);
playerInventory.setItemInHand(hand, currentlyEquipped);
if (currentlyEquipped.isAir()) {
playerInventory.setEquipment(equipmentSlot, itemStack);
playerInventory.setItemInHand(hand, currentlyEquipped);
}
}
PlayerItemAnimationEvent.ItemAnimationType itemAnimationType = null;