Add logic for Human canUseEquipmentSlot (#12433)

This commit is contained in:
Pedro
2025-04-14 16:12:09 -04:00
committed by GitHub
parent 6b4ad08259
commit c0bd5688b5

View File

@ -41,6 +41,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.CraftEquipmentSlot;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.inventory.CraftContainer;
@ -922,6 +923,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return success ? (Firework) fireworks.getBukkitEntity() : null;
}
@Override
public boolean canUseEquipmentSlot(org.bukkit.inventory.EquipmentSlot slot) {
net.minecraft.world.entity.EquipmentSlot equipmentSlot = CraftEquipmentSlot.getNMS(slot);
return (equipmentSlot.getType() == net.minecraft.world.entity.EquipmentSlot.Type.HUMANOID_ARMOR || equipmentSlot.getType() == net.minecraft.world.entity.EquipmentSlot.Type.HAND) && super.canUseEquipmentSlot(slot);
}
@Override
public org.bukkit.entity.Entity copy() {
throw new UnsupportedOperationException("Cannot copy human entities");