Skip to content

Commit 48e926e

Browse files
committed
Add No Crash for Elytra Fly+
1 parent a174170 commit 48e926e

3 files changed

Lines changed: 42 additions & 9 deletions

File tree

build.gradle

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,19 @@ dependencies {
5555
// Mixin extras
5656
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.1")))
5757

58-
// Meteor Client
59-
modImplementation files("libs\\baritone-unoptimized-fabric-1.10.1-11-g3ed49fd4.jar")
60-
modImplementation files("libs\\meteor-client-0.5.8-2200.jar")
58+
// Meteor Client and Baritone
59+
modImplementation files("libs\\baritone-unoptimized-fabric-1.10.1-11-g3ed49fd4.jar") // Baritone
60+
modImplementation files("libs\\meteor-client-0.5.8-2200.jar") // Meteor Client
6161

6262
// Xaero's Mods
6363
modCompileOnly "maven.modrinth:xaeros-world-map:${project.xwm_fabric_version}" // Xaero's World Map
6464
modCompileOnly "maven.modrinth:xaeros-minimap:${project.xmm_fabric_version}" // Xaero's Minimap
65-
65+
66+
modCompileOnly "maven.modrinth:litematica:${project.litematica_version}" // Litematica
67+
6668
// Chest Tracker
67-
modImplementation("red.jackf:whereisit:${project.where_is_it_version}")
68-
modImplementation("maven.modrinth:chest-tracker:${project.chest_tracker}")
69+
modImplementation("red.jackf:whereisit:${project.where_is_it_version}") // Library for Chect Tracker
70+
modImplementation("maven.modrinth:chest-tracker:${project.chest_tracker}") // Chest Tracker
6971
}
7072

7173
loom {

gradle.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ xwm_fabric_version=1.38.8_Fabric_1.21
2525
# Xaero's Minimap (https://modrinth.com/mod/xaeros-minimap/versions)
2626
xmm_fabric_version=24.2.1_Fabric_1.21
2727

28-
# Litematica (https://www.curseforge.com/minecraft/mc-mods/litematica/files/all?page=1&pageSize=20)
29-
litematica_fileid=4946471
30-
litematica_projectid=308892
28+
# Litematica (https://modrinth.com/mod/litematica/versions)
29+
litematica_version=0.19.57
3130

3231
# Where Is It (https://modrinth.com/mod/where-is-it/versions)
3332
where_is_it_version=2.6.3+1.21.1

src/main/java/nekiplay/meteorplus/features/modules/movement/elytrafly/ElytraFlyPlus.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33
import meteordevelopment.meteorclient.events.entity.player.PlayerMoveEvent;
44
import meteordevelopment.meteorclient.events.packets.PacketEvent;
55
import meteordevelopment.meteorclient.events.world.TickEvent;
6+
import meteordevelopment.meteorclient.mixininterface.IVec3d;
67
import meteordevelopment.meteorclient.settings.*;
78
import meteordevelopment.meteorclient.systems.modules.Categories;
89
import meteordevelopment.meteorclient.systems.modules.Module;
910
import meteordevelopment.orbit.EventHandler;
1011
import meteordevelopment.starscript.compiler.Expr;
1112
import nekiplay.meteorplus.features.modules.movement.elytrafly.modes.Control;
1213
import 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

1420
public 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

Comments
 (0)