Search in sources :

Example 26 with EntityEquipment

use of org.bukkit.inventory.EntityEquipment in project Denizen-For-Bukkit by DenizenScript.

the class PacketHelperImpl method resetEquipment.

@Override
public void resetEquipment(Player player, LivingEntity entity) {
    EntityEquipment equipment = entity.getEquipment();
    ArrayList<Pair<EnumItemSlot, net.minecraft.server.v1_16_R3.ItemStack>> pairList = new ArrayList<>();
    pairList.add(new Pair<>(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(equipment.getItemInMainHand())));
    pairList.add(new Pair<>(EnumItemSlot.OFFHAND, CraftItemStack.asNMSCopy(equipment.getItemInOffHand())));
    pairList.add(new Pair<>(EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(equipment.getHelmet())));
    pairList.add(new Pair<>(EnumItemSlot.CHEST, CraftItemStack.asNMSCopy(equipment.getChestplate())));
    pairList.add(new Pair<>(EnumItemSlot.LEGS, CraftItemStack.asNMSCopy(equipment.getLeggings())));
    pairList.add(new Pair<>(EnumItemSlot.FEET, CraftItemStack.asNMSCopy(equipment.getBoots())));
    sendPacket(player, new PacketPlayOutEntityEquipment(entity.getEntityId(), pairList));
}
Also used : net.minecraft.server.v1_16_R3(net.minecraft.server.v1_16_R3) EntityEquipment(org.bukkit.inventory.EntityEquipment) Pair(com.mojang.datafixers.util.Pair)

Aggregations

EntityEquipment (org.bukkit.inventory.EntityEquipment)26 ItemStack (org.bukkit.inventory.ItemStack)15 LivingEntity (org.bukkit.entity.LivingEntity)8 Player (org.bukkit.entity.Player)6 Entity (org.bukkit.entity.Entity)5 ArrayList (java.util.ArrayList)4 Location (org.bukkit.Location)4 Item (org.bukkit.entity.Item)4 Pair (com.mojang.datafixers.util.Pair)3 Mage (com.elmakers.mine.bukkit.api.magic.Mage)2 Mob (com.jacob_vejvoda.infernal_mobs.persist.Mob)2 LinkedList (java.util.LinkedList)2 UUID (java.util.UUID)2 AttributeManager (net.glowstone.entity.AttributeManager)2 GlowLeashHitch (net.glowstone.entity.objects.GlowLeashHitch)2 CompoundTag (net.glowstone.util.nbt.CompoundTag)2 AttributeModifier (org.bukkit.attribute.AttributeModifier)2 Enderman (org.bukkit.entity.Enderman)2 LeashHitch (org.bukkit.entity.LeashHitch)2 PlayerInventory (org.bukkit.inventory.PlayerInventory)2