PacketContainer#getEntityUseActions() no longer works in 1.17
josemmo opened this issue ยท 1 comments
Describe the bug
Method "getEntityUseActions()" from PacketContainer no longer works in 1.17 as "PacketPlayInUseEntity" NMS class replaced its "EnumEntityUseAction" enum with an interface.
To Reproduce
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, PacketType.Play.Client.USE_ENTITY) {
@Override
public void onPacketReceiving(PacketEvent event) {
System.out.println("EntityUseAction: " + event.getPacket().getEntityUseActions());
System.out.println("Modifier: " + event.getPacket().getModifier());
}
});
Output for v1.16 (expected):
EntityUseAction: StructureModifier[fieldType=class net.minecraft.server.v1_16_R3.PacketPlayInUseEntity$EnumEntityUseAction, data=[private net.minecraft.server.v1_16_R3.PacketPlayInUseEntity$EnumEntityUseAction net.minecraft.server.v1_16_R3.PacketPlayInUseEntity.action]]
Modifier: StructureModifier[fieldType=class java.lang.Object, data=[private int net.minecraft.server.v1_16_R3.PacketPlayInUseEntity.a, private net.minecraft.server.v1_16_R3.PacketPlayInUseEntity$EnumEntityUseAction net.minecraft.server.v1_16_R3.PacketPlayInUseEntity.action, private net.minecraft.server.v1_16_R3.Vec3D net.minecraft.server.v1_16_R3.PacketPlayInUseEntity.c, private net.minecraft.server.v1_16_R3.EnumHand net.minecraft.server.v1_16_R3.PacketPlayInUseEntity.d, private boolean net.minecraft.server.v1_16_R3.PacketPlayInUseEntity.e]]
Output for v1.17 (failing):
EntityUseAction: StructureModifier[fieldType=null, data=[]]
Modifier: StructureModifier[fieldType=class java.lang.Object, data=[private final int net.minecraft.network.protocol.game.PacketPlayInUseEntity.a, private final net.minecraft.network.protocol.game.PacketPlayInUseEntity$EnumEntityUseAction net.minecraft.network.protocol.game.PacketPlayInUseEntity.b, private final boolean net.minecraft.network.protocol.game.PacketPlayInUseEntity.c]]
Additional context
Skeleton for PacketPlayInUseEntity (v1.16):
public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> {
private int a;
private PacketPlayInUseEntity.EnumEntityUseAction action;
// [...]
public static enum EnumEntityUseAction {
INTERACT,
ATTACK,
INTERACT_AT;
// [...]
}
}
Skeleton for PacketPlayInUseEntity (v1.17):
public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> {
private final int a;
private final PacketPlayInUseEntity.EnumEntityUseAction b;
// [...]
interface EnumEntityUseAction {
PacketPlayInUseEntity.b a();
void a(PacketPlayInUseEntity.c var1);
void a(PacketDataSerializer var1);
}
// [...]
}