[1.21] Entity Equipment packet not work
Gennario opened this issue ยท 1 comments
- This issue is not solved in a development build
I have a issue with ENTITY_EQUIPMENT. I got this error
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: java.lang.RuntimeException: Failed to make NMS copy of ItemStack{PAPER x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name={"text":"example","italic":false,"color":"white"}, custom-model-data=10007, custom=H4sIAAAAAAAA/wXBUQqAIBAFwEc/2uIll/aFgmuiRh3fGQEEUhZ9qhlHxFEMgb96r4w4mzpn14tI9zPW2/hlsgIbUUbRtzoAAAA=}}
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.utility.MinecraftReflection.getMinecraftItemStack(MinecraftReflection.java:1463)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.BukkitConverters$15.getGeneric(BukkitConverters.java:930)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.BukkitConverters$15.getGeneric(BukkitConverters.java:922)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.BukkitConverters$4.getGeneric(BukkitConverters.java:395)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.BukkitConverters$4.getGeneric(BukkitConverters.java:391)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.Converters$1.getGeneric(Converters.java:57)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.BukkitConverters.getGenericList(BukkitConverters.java:309)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.BukkitConverters.access$100(BukkitConverters.java:97)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.BukkitConverters$3.getGeneric(BukkitConverters.java:376)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.BukkitConverters$3.getGeneric(BukkitConverters.java:368)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.wrappers.Converters$1.getGeneric(Converters.java:57)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:360)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:324)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at FortuneWheel-BETA-1.9.jar//cz.gennario.fortunewheel.utils.packet.PacketUtils.getEquipmentPacket(PacketUtils.java:224)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at FortuneWheel-BETA-1.9.jar//cz.gennario.fortunewheel.utils.packet.entity.PacketEntity.updateEntity(PacketEntity.java:109)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at FortuneWheel-BETA-1.9.jar//cz.gennario.fortunewheel.utils.packet.types.PacketArmorStand.updateArmorStand(PacketArmorStand.java:46)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at FortuneWheel-BETA-1.9.jar//cz.gennario.fortunewheel.utils.packet.types.PacketArmorStand.spawn(PacketArmorStand.java:40)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at FortuneWheel-BETA-1.9.jar//cz.gennario.fortunewheel.wheel.Wheel.show(Wheel.java:641)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at FortuneWheel-BETA-1.9.jar//cz.gennario.fortunewheel.wheel.Wheel$1.run(Wheel.java:211)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at org.bukkit.craftbukkit.scheduler.CraftTask.run(CraftTask.java:86)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at org.bukkit.craftbukkit.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:57)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at java.base/java.lang.Thread.run(Thread.java:1583)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: Caused by: java.lang.IllegalStateException: Unable to invoke method public static net.minecraft.world.item.ItemStack org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(org.bukkit.inventory.ItemStack)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:25)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.utility.MinecraftReflection.getMinecraftItemStack(MinecraftReflection.java:1461)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: ... 24 more
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: Caused by: java.lang.ClassCastException: Cannot cast ia.m.eH to org.bukkit.craftbukkit.inventory.CraftItemStack
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at java.base/java.lang.Class.cast(Class.java:4067)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at org.bukkit.craftbukkit.inventory.CraftItemStack.getCraftStack(CraftItemStack.java:46)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(CraftItemStack.java:97)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: at ProtocolLib(26).jar//com.comphenix.protocol.reflect.accessors.DefaultMethodAccessor.invoke(DefaultMethodAccessor.java:23)
[18:32:50] [Craft Scheduler Thread - 3 - FortuneWheel/WARN]: ... 25 more
Code:
public static PacketContainer getEquipmentPacket(int entityId, Pair<EnumWrappers.ItemSlot, ItemStack>... items) {
try {
PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_EQUIPMENT);
packet.getIntegers().write(0, entityId);
List<Pair<EnumWrappers.ItemSlot, ItemStack>> list = Arrays.asList(items);
packet.getSlotStackPairLists().writeSafely(0, list);
return packet;
} catch (Exception e) {
if (debug) e.printStackTrace();
return getEquipmentPacket(entityId, items);
}
}