From 81eea75d3a0be8b3ebf05a5d1fcef828ece72875 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Mon, 24 Jun 2024 06:58:11 +0200 Subject: [PATCH] mini refactor --- .../client/feature/modules/movement/NoFall.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Client/src/main/java/de/com/baseband/client/feature/modules/movement/NoFall.java b/Client/src/main/java/de/com/baseband/client/feature/modules/movement/NoFall.java index 8af743f..5b8695c 100644 --- a/Client/src/main/java/de/com/baseband/client/feature/modules/movement/NoFall.java +++ b/Client/src/main/java/de/com/baseband/client/feature/modules/movement/NoFall.java @@ -77,16 +77,21 @@ public class NoFall extends Feature { } } + private static final DataParameter FLAGS; + + static { + try { + FLAGS = (DataParameter) 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 FLAGS = (DataParameter) 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 } } }