mini refactor
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m17s

This commit is contained in:
Daniella / Tove 2024-06-24 06:58:11 +02:00
parent 77f6aa2778
commit 81eea75d3a
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -77,16 +77,21 @@ public class NoFall extends Feature {
}
}
private static final DataParameter<Byte> FLAGS;
static {
try {
FLAGS = (DataParameter<Byte>) FieldFinder.findUnmarked(Entity.class, DataParameter.class, 0).get(null);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
public void onReceive(PacketEvent.Receive event) {
if(event.getPacket() instanceof SPacketEntityMetadata) {
SPacketEntityMetadata packet = (SPacketEntityMetadata) event.getPacket();
if(mode == Mode.Elytra && cancelElytraNT != 0 && packet.getEntityId() == mc.player.getEntityId()) {
try {
DataParameter<Byte> FLAGS = (DataParameter<Byte>) FieldFinder.findUnmarked(Entity.class, DataParameter.class, 0).get(null);
packet.getDataManagerEntries().removeIf(x -> x.getKey().equals(FLAGS)); // remove FallFlying tag
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
packet.getDataManagerEntries().removeIf(x -> x.getKey().equals(FLAGS)); // remove FallFlying tag to stop elytra from starting clientside
}
}
}