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,9 +34,11 @@ public class UseItemListener {
final EquipmentSlot equipmentSlot = material.registry().equipmentSlot(); final EquipmentSlot equipmentSlot = material.registry().equipmentSlot();
if (equipmentSlot != null) { if (equipmentSlot != null) {
final ItemStack currentlyEquipped = playerInventory.getEquipment(equipmentSlot); final ItemStack currentlyEquipped = playerInventory.getEquipment(equipmentSlot);
if (currentlyEquipped.isAir()) {
playerInventory.setEquipment(equipmentSlot, itemStack); playerInventory.setEquipment(equipmentSlot, itemStack);
playerInventory.setItemInHand(hand, currentlyEquipped); playerInventory.setItemInHand(hand, currentlyEquipped);
} }
}
PlayerItemAnimationEvent.ItemAnimationType itemAnimationType = null; PlayerItemAnimationEvent.ItemAnimationType itemAnimationType = null;
boolean riptideSpinAttack = false; boolean riptideSpinAttack = false;