3
3
import meteordevelopment .meteorclient .events .entity .player .PlayerMoveEvent ;
4
4
import meteordevelopment .meteorclient .events .packets .PacketEvent ;
5
5
import meteordevelopment .meteorclient .events .world .TickEvent ;
6
+ import meteordevelopment .meteorclient .mixininterface .IVec3d ;
6
7
import meteordevelopment .meteorclient .settings .*;
7
8
import meteordevelopment .meteorclient .systems .modules .Categories ;
8
9
import meteordevelopment .meteorclient .systems .modules .Module ;
9
10
import meteordevelopment .orbit .EventHandler ;
10
11
import meteordevelopment .starscript .compiler .Expr ;
11
12
import nekiplay .meteorplus .features .modules .movement .elytrafly .modes .Control ;
12
13
import nekiplay .meteorplus .features .modules .movement .elytrafly .modes .Wasp ;
14
+ import net .minecraft .util .hit .BlockHitResult ;
15
+ import net .minecraft .util .hit .HitResult ;
16
+ import net .minecraft .util .math .Vec3d ;
17
+ import net .minecraft .world .RaycastContext ;
13
18
14
19
public class ElytraFlyPlus extends Module {
15
20
private final SettingGroup sgGeneral = settings .getDefaultGroup ();
@@ -123,6 +128,23 @@ public class ElytraFlyPlus extends Module {
123
128
.build ()
124
129
);
125
130
131
+ public final Setting <Boolean > noCrash = sgGeneral .add (new BoolSetting .Builder ()
132
+ .name ("no-crash" )
133
+ .description ("Stops you from going into walls." )
134
+ .defaultValue (false )
135
+ .build ()
136
+ );
137
+
138
+ public final Setting <Integer > crashLookAhead = sgGeneral .add (new IntSetting .Builder ()
139
+ .name ("crash-look-ahead" )
140
+ .description ("Distance to look ahead when flying." )
141
+ .defaultValue (5 )
142
+ .range (1 , 15 )
143
+ .sliderMin (1 )
144
+ .visible (noCrash ::get )
145
+ .build ()
146
+ );
147
+
126
148
private ElytraFlyMode currentMode = new Control ();
127
149
128
150
public ElytraFlyPlus () {
@@ -142,6 +164,15 @@ public void onDeactivate() {
142
164
@ EventHandler
143
165
private void onPlayerMove (PlayerMoveEvent event ) {
144
166
currentMode .onPlayerMove (event );
167
+
168
+ if (noCrash .get () && mc .player .isGliding ()) {
169
+ Vec3d lookAheadPos = mc .player .getPos ().add (mc .player .getVelocity ().normalize ().multiply (crashLookAhead .get ()));
170
+ RaycastContext raycastContext = new RaycastContext (mc .player .getPos (), new Vec3d (lookAheadPos .getX (), mc .player .getY (), lookAheadPos .getZ ()), RaycastContext .ShapeType .COLLIDER , RaycastContext .FluidHandling .NONE , mc .player );
171
+ BlockHitResult hitResult = mc .world .raycast (raycastContext );
172
+ if (hitResult != null && hitResult .getType () == HitResult .Type .BLOCK ) {
173
+ ((IVec3d ) event .movement ).meteor$set (0 , currentMode .velY , 0 );
174
+ }
175
+ }
145
176
}
146
177
147
178
@ EventHandler
0 commit comments