Fix a null error

This commit is contained in:
libraryaddict 2021-10-10 14:01:08 +13:00
parent 7e099a985c
commit a032155f5b

View File

@ -75,7 +75,11 @@ public class PacketListenerClientInteract extends PacketAdapter {
private EnumWrappers.Hand getHand(PacketContainer packet) { private EnumWrappers.Hand getHand(PacketContainer packet) {
if (!NmsVersion.v1_17.isSupported()) { if (!NmsVersion.v1_17.isSupported()) {
return packet.getHands().read(0); if (getInteractType(packet) != EnumWrappers.EntityUseAction.ATTACK) {
return packet.getHands().read(0);
}
return EnumWrappers.Hand.MAIN_HAND;
} }
WrappedEnumEntityUseAction action = packet.getEnumEntityUseActions().read(0); WrappedEnumEntityUseAction action = packet.getEnumEntityUseActions().read(0);