33import meteordevelopment .meteorclient .events .entity .player .PlayerMoveEvent ;
44import meteordevelopment .meteorclient .events .packets .PacketEvent ;
55import meteordevelopment .meteorclient .events .world .TickEvent ;
6+ import meteordevelopment .meteorclient .mixininterface .IVec3d ;
67import meteordevelopment .meteorclient .settings .*;
78import meteordevelopment .meteorclient .systems .modules .Categories ;
89import meteordevelopment .meteorclient .systems .modules .Module ;
910import meteordevelopment .orbit .EventHandler ;
1011import meteordevelopment .starscript .compiler .Expr ;
1112import nekiplay .meteorplus .features .modules .movement .elytrafly .modes .Control ;
1213import nekiplay .meteorplus .features .modules .movement .elytrafly .modes .Wasp ;
14+ import net .minecraft .entity .EntityPose ;
15+ import net .minecraft .util .hit .BlockHitResult ;
16+ import net .minecraft .util .hit .HitResult ;
17+ import net .minecraft .util .math .Vec3d ;
18+ import net .minecraft .world .RaycastContext ;
1319
1420public class ElytraFlyPlus extends Module {
1521 private final SettingGroup sgGeneral = settings .getDefaultGroup ();
@@ -123,6 +129,23 @@ public class ElytraFlyPlus extends Module {
123129 .build ()
124130 );
125131
132+ public final Setting <Boolean > noCrash = sgGeneral .add (new BoolSetting .Builder ()
133+ .name ("no-crash" )
134+ .description ("Stops you from going into walls." )
135+ .defaultValue (false )
136+ .build ()
137+ );
138+
139+ public final Setting <Integer > crashLookAhead = sgGeneral .add (new IntSetting .Builder ()
140+ .name ("crash-look-ahead" )
141+ .description ("Distance to look ahead when flying." )
142+ .defaultValue (5 )
143+ .range (1 , 15 )
144+ .sliderMin (1 )
145+ .visible (noCrash ::get )
146+ .build ()
147+ );
148+
126149 private ElytraFlyMode currentMode = new Control ();
127150
128151 public ElytraFlyPlus () {
@@ -142,6 +165,15 @@ public void onDeactivate() {
142165 @ EventHandler
143166 private void onPlayerMove (PlayerMoveEvent event ) {
144167 currentMode .onPlayerMove (event );
168+
169+ if (noCrash .get () && mc .player .getPose () == EntityPose .FALL_FLYING ) {
170+ Vec3d lookAheadPos = mc .player .getPos ().add (mc .player .getVelocity ().normalize ().multiply (crashLookAhead .get ()));
171+ RaycastContext raycastContext = new RaycastContext (mc .player .getPos (), new Vec3d (lookAheadPos .getX (), mc .player .getY (), lookAheadPos .getZ ()), RaycastContext .ShapeType .COLLIDER , RaycastContext .FluidHandling .NONE , mc .player );
172+ BlockHitResult hitResult = mc .world .raycast (raycastContext );
173+ if (hitResult != null && hitResult .getType () == HitResult .Type .BLOCK ) {
174+ ((IVec3d ) event .movement ).set (0 , currentMode .velY , 0 );
175+ }
176+ }
145177 }
146178
147179 @ EventHandler
0 commit comments