use of net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment in project InteractionVisualizer by LOOHP.
the class V1_18 method createEntityEquipmentPacket.
@Override
public PacketContainer[] createEntityEquipmentPacket(int entityId, List<ValuePairs<EquipmentSlot, ItemStack>> equipments) {
List<Pair<EnumItemSlot, net.minecraft.world.item.ItemStack>> nmsList = new ArrayList<>();
for (ValuePairs<EquipmentSlot, ItemStack> pair : equipments) {
EnumItemSlot nmsSlot;
switch(pair.getFirst()) {
case CHEST:
nmsSlot = EnumItemSlot.e;
break;
case FEET:
nmsSlot = EnumItemSlot.c;
break;
case HEAD:
nmsSlot = EnumItemSlot.f;
break;
case LEGS:
nmsSlot = EnumItemSlot.d;
break;
case OFF_HAND:
nmsSlot = EnumItemSlot.b;
break;
case HAND:
default:
nmsSlot = EnumItemSlot.a;
break;
}
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(pair.getSecond());
nmsList.add(new Pair<>(nmsSlot, nmsItem));
}
PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment(entityId, nmsList);
return new PacketContainer[] { PacketContainer.fromPacket(packet) };
}
use of net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment in project InteractionVisualizer by LOOHP.
the class V1_18_2 method createEntityEquipmentPacket.
@Override
public PacketContainer[] createEntityEquipmentPacket(int entityId, List<ValuePairs<EquipmentSlot, ItemStack>> equipments) {
List<Pair<EnumItemSlot, net.minecraft.world.item.ItemStack>> nmsList = new ArrayList<>();
for (ValuePairs<EquipmentSlot, ItemStack> pair : equipments) {
EnumItemSlot nmsSlot;
switch(pair.getFirst()) {
case CHEST:
nmsSlot = EnumItemSlot.e;
break;
case FEET:
nmsSlot = EnumItemSlot.c;
break;
case HEAD:
nmsSlot = EnumItemSlot.f;
break;
case LEGS:
nmsSlot = EnumItemSlot.d;
break;
case OFF_HAND:
nmsSlot = EnumItemSlot.b;
break;
case HAND:
default:
nmsSlot = EnumItemSlot.a;
break;
}
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(pair.getSecond());
nmsList.add(new Pair<>(nmsSlot, nmsItem));
}
PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment(entityId, nmsList);
return new PacketContainer[] { PacketContainer.fromPacket(packet) };
}
use of net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment in project InteractionVisualizer by LOOHP.
the class V1_17 method createEntityEquipmentPacket.
@Override
public PacketContainer[] createEntityEquipmentPacket(int entityId, List<ValuePairs<EquipmentSlot, ItemStack>> equipments) {
List<Pair<EnumItemSlot, net.minecraft.world.item.ItemStack>> nmsList = new ArrayList<>();
for (ValuePairs<EquipmentSlot, ItemStack> pair : equipments) {
EnumItemSlot nmsSlot;
switch(pair.getFirst()) {
case CHEST:
nmsSlot = EnumItemSlot.e;
break;
case FEET:
nmsSlot = EnumItemSlot.c;
break;
case HEAD:
nmsSlot = EnumItemSlot.f;
break;
case LEGS:
nmsSlot = EnumItemSlot.d;
break;
case OFF_HAND:
nmsSlot = EnumItemSlot.b;
break;
case HAND:
default:
nmsSlot = EnumItemSlot.a;
break;
}
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(pair.getSecond());
nmsList.add(new Pair<>(nmsSlot, nmsItem));
}
PacketPlayOutEntityEquipment packet = new PacketPlayOutEntityEquipment(entityId, nmsList);
return new PacketContainer[] { PacketContainer.fromPacket(packet) };
}
Aggregations