Skip to content

Commit dcfe382

Browse files
committed
Refactor ElytraFlyPlusPlus settings and logic
Standardized setting names to kebab-case, added 'only-while-colliding' option for motion Y boost, and improved descriptions for custom yaw and start position. Updated module group, enhanced collision and portal trap logic, and fixed sound event handling for fake fly mode.
1 parent da09c3f commit dcfe382

1 file changed

Lines changed: 46 additions & 37 deletions

File tree

src/main/java/dev/journey/PathSeeker/modules/utility/ElytraFlyPlusPlus.java

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,38 @@ public class ElytraFlyPlusPlus extends Module {
4545
private final SettingGroup sgObstaclePasser = settings.createGroup("Obstacle Passer");
4646

4747
private final Setting<Boolean> bounce = sgGeneral.add(new BoolSetting.Builder()
48-
.name("Bounce")
48+
.name("bounce")
4949
.description("Automatically does bounce efly.")
5050
.defaultValue(false)
5151
.build()
5252
);
5353

5454
private final Setting<Boolean> motionYBoost = sgGeneral.add(new BoolSetting.Builder()
55-
.name("Motion Y Boost")
55+
.name("motion-y-boost")
5656
.description("Greatly increases speed by cancelling Y momentum.")
5757
.defaultValue(false)
5858
.visible(bounce::get)
5959
.build()
6060
);
6161

62+
private final Setting<Boolean> onlyWhileColliding = sgGeneral.add(new BoolSetting.Builder()
63+
.name("only-while-colliding")
64+
.description("Only enables motion y boost if colliding with a wall.")
65+
.defaultValue(true)
66+
.visible(() -> bounce.get() && motionYBoost.get())
67+
.build()
68+
);
69+
6270
private final Setting<Boolean> tunnelBounce = sgGeneral.add(new BoolSetting.Builder()
63-
.name("Tunnel Bounce")
71+
.name("tunnel-bounce")
6472
.description("Allows you to bounce in 1x2 tunnels. This should not be on if you are not in a tunnel.")
6573
.defaultValue(false)
6674
.visible(() -> bounce.get() && motionYBoost.get())
6775
.build()
6876
);
6977

7078
private final Setting<Double> speed = sgGeneral.add(new DoubleSetting.Builder()
71-
.name("Speed")
79+
.name("speed")
7280
.description("The speed in blocks per second to keep you at.")
7381
.defaultValue(100.0)
7482
.sliderRange(20, 250)
@@ -77,15 +85,15 @@ public class ElytraFlyPlusPlus extends Module {
7785
);
7886

7987
private final Setting<Boolean> lockPitch = sgGeneral.add(new BoolSetting.Builder()
80-
.name("Lock Pitch")
88+
.name("lock-pitch")
8189
.description("Whether to lock your pitch when bounce is enabled.")
8290
.defaultValue(true)
8391
.visible(bounce::get)
8492
.build()
8593
);
8694

8795
private final Setting<Double> pitch = sgGeneral.add(new DoubleSetting.Builder()
88-
.name("Pitch")
96+
.name("pitch")
8997
.description("The pitch to set when bounce is enabled.")
9098
.defaultValue(90.0)
9199
.sliderRange(-90, 90)
@@ -94,88 +102,86 @@ public class ElytraFlyPlusPlus extends Module {
94102
);
95103

96104
private final Setting<Boolean> lockYaw = sgGeneral.add(new BoolSetting.Builder()
97-
.name("Lock Yaw")
105+
.name("lock-yaw")
98106
.description("Whether to lock your yaw when bounce is enabled.")
99107
.defaultValue(false)
100108
.visible(bounce::get)
101109
.build()
102110
);
103111

104112
private final Setting<Boolean> useCustomYaw = sgGeneral.add(new BoolSetting.Builder()
105-
.name("Use Custom Yaw")
106-
.description("Enable this if you want to use a yaw that isn't a factor of 45.")
113+
.name("use-custom-yaw")
114+
.description("Enable this if you want to use a yaw that isn't a factor of 45. WARNING: This effects the baritone goal for obstacle passer, " +
115+
"use the default Rotations module if you only want a different yawlock.")
107116
.defaultValue(false)
108117
.visible(bounce::get)
109118
.build()
110119
);
111120

112121
private final Setting<Double> yaw = sgGeneral.add(new DoubleSetting.Builder()
113-
.name("Yaw")
114-
.description("The yaw to set when bounce is enabled. This is auto set to the closest 45 deg angle to you unless Use Custom Yaw is enabled.")
122+
.name("yaw")
123+
.description("The yaw to set when bounce is enabled. This is auto set to the closest 45 deg angle to you unless Use Custom Yaw is enabled. " +
124+
"WARNING: This effects the baritone goal for obstacle passer, use the default Rotations module if you only want a different yawlock.")
115125
.defaultValue(0.0)
116126
.sliderRange(0, 359)
117127
.visible(() -> bounce.get() && useCustomYaw.get())
118128
.build()
119129
);
120130

121131
private final Setting<Boolean> highwayObstaclePasser = sgObstaclePasser.add(new BoolSetting.Builder()
122-
.name("Highway Obstacle Passer")
132+
.name("highway-obstacle-passer")
123133
.description("Uses baritone to pass obstacles.")
124134
.defaultValue(false)
125135
.visible(bounce::get)
126136
.build()
127137
);
128138

129139
private final Setting<Boolean> useCustomStartPos = sgObstaclePasser.add(new BoolSetting.Builder()
130-
.name("Use Custom Start Position")
140+
.name("use-custom-start-position")
131141
.description("Enable and set this ONLY if you are on a ringroad or don't want to be locked to a highway. Otherwise (0, 0) is the start position and will be automatically used.")
132142
.defaultValue(false)
133143
.visible(() -> bounce.get() && highwayObstaclePasser.get())
134144
.build()
135145
);
136-
137-
private final Setting<BlockPos> startPos = sgObstaclePasser.add(new BlockPosSetting.Builder()
138-
.name("Start Position")
139-
.description("The start position to use when using a custom start position.")
140-
.defaultValue(new BlockPos(0, 0, 0))
141-
.visible(() -> bounce.get() && highwayObstaclePasser.get() && useCustomStartPos.get())
142-
.build()
143-
);
144-
145146
private final Setting<Boolean> awayFromStartPos = sgObstaclePasser.add(new BoolSetting.Builder()
146-
.name("Away From Start Position")
147+
.name("away-from-start-position")
147148
.description("If true, will go away from the start position instead of towards it. The start pos is (0,0) if it is not set to a custom start pos.")
148149
.defaultValue(true)
149150
.visible(() -> bounce.get() && highwayObstaclePasser.get())
150151
.build()
151152
);
152-
153153
private final Setting<Double> distance = sgObstaclePasser.add(new DoubleSetting.Builder()
154-
.name("Distance")
154+
.name("distance")
155155
.description("The distance to set the baritone goal for path realignment.")
156156
.defaultValue(10.0)
157157
.visible(() -> bounce.get() && highwayObstaclePasser.get())
158158
.build()
159159
);
160-
161160
private final Setting<Integer> targetY = sgObstaclePasser.add(new IntSetting.Builder()
162-
.name("Y Level")
161+
.name("y-level")
163162
.description("The Y level to bounce at. This must be correct or bounce will not start properly.")
164163
.defaultValue(120)
165164
.visible(() -> bounce.get() && highwayObstaclePasser.get())
166165
.build()
167166
);
168-
167+
private final Setting<BlockPos> startPos = sgObstaclePasser.add(new BlockPosSetting.Builder()
168+
.name("start-position")
169+
.description("The start position to use when using a custom start position.")
170+
.defaultValue(new BlockPos(0, 0, 0))
171+
.visible(() -> bounce.get() && highwayObstaclePasser.get() && useCustomStartPos.get())
172+
.onChanged(pos -> this.targetY.set(pos.getY()))
173+
.build()
174+
);
169175
private final Setting<Boolean> avoidPortalTraps = sgObstaclePasser.add(new BoolSetting.Builder()
170-
.name("Avoid Portal Traps")
176+
.name("avoid-portal-traps")
171177
.description("Will attempt to detect portal traps on chunk load and avoid them.")
172178
.defaultValue(false)
173179
.visible(() -> bounce.get() && highwayObstaclePasser.get())
174180
.build()
175181
);
176182

177183
private final Setting<Double> portalAvoidDistance = sgObstaclePasser.add(new DoubleSetting.Builder()
178-
.name("Portal Avoid Distance")
184+
.name("portal-avoid-distance")
179185
.description("The distance to a portal trap where the obstacle passer will takeover and go around it.")
180186
.defaultValue(20)
181187
.min(0)
@@ -185,7 +191,7 @@ public class ElytraFlyPlusPlus extends Module {
185191
);
186192

187193
private final Setting<Integer> portalScanWidth = sgObstaclePasser.add(new IntSetting.Builder()
188-
.name("Portal Scan Width")
194+
.name("portal-scan-width")
189195
.description("The width on the axis of the highway that will be scanned for portal traps.")
190196
.defaultValue(5)
191197
.min(3)
@@ -195,14 +201,14 @@ public class ElytraFlyPlusPlus extends Module {
195201
);
196202

197203
private final Setting<Boolean> fakeFly = sgGeneral.add(new BoolSetting.Builder()
198-
.name("Chestplate / Fakefly")
204+
.name("chestplate-fakefly")
199205
.description("Lets you fly using a chestplate to use almost 0 elytra durability. Must have elytra in hotbar.")
200206
.defaultValue(false)
201207
.build()
202208
);
203209

204210
private final Setting<Boolean> toggleElytra = sgGeneral.add(new BoolSetting.Builder()
205-
.name("Toggle Elytra")
211+
.name("toggle-elytra")
206212
.description("Equips an elytra on activate, and a chestplate on deactivate.")
207213
.defaultValue(false)
208214
.visible(() -> !fakeFly.get())
@@ -226,7 +232,7 @@ public class ElytraFlyPlusPlus extends Module {
226232

227233
public ElytraFlyPlusPlus() {
228234
super(
229-
PathSeeker.Utility,
235+
PathSeeker.Hunting,
230236
"ElytraFlyPlusPlus",
231237
"Elytra fly with some more features."
232238
);
@@ -290,6 +296,8 @@ private void onPlayerMove(PlayerMoveEvent event) {
290296
if (mc.player == null || event.type != MovementType.SELF || !enabled() || !motionYBoost.get() || !bounce.get())
291297
return;
292298

299+
if (onlyWhileColliding.get() && !mc.player.horizontalCollision) return;
300+
293301
if (lastPos != null) {
294302
double speedBps = mc.player.getPos().subtract(lastPos).multiply(20, 0, 20).length();
295303

@@ -364,7 +372,7 @@ private void onTick(TickEvent.Pre event) {
364372
}
365373

366374
if (highwayObstaclePasser.get() && mc.player.getPos().length() > 100 && // > 100 check needed bc server sends queue coordinates when joining in first tick causing goal coordinates to be set to (0, 0)
367-
(mc.player.getY() < targetY.get() || mc.player.getY() > targetY.get() + 2 || mc.player.horizontalCollision // collisions / out of highway
375+
(mc.player.getY() < targetY.get() || mc.player.getY() > targetY.get() + 2 || (mc.player.horizontalCollision && !mc.player.collidedSoftly) // collisions / out of highway
368376
|| (portalTrap != null && portalTrap.getSquaredDistance(mc.player.getBlockPos()) < portalAvoidDistance.get() * portalAvoidDistance.get()) // portal trap detection
369377
|| waitingForChunksToLoad // waiting for chunks to load
370378
|| stuckTimer > 50)) {
@@ -460,6 +468,7 @@ private void doGrimEflyStuff() {
460468

461469
@EventHandler
462470
private void onPlaySound(PlaySoundEvent event) {
471+
if (!fakeFly.get()) return;
463472
List<Identifier> armorEquipSounds = List.of(
464473
Identifier.of("minecraft:item.armor.equip_generic"),
465474
Identifier.of("minecraft:item.armor.equip_netherite"),
@@ -507,8 +516,8 @@ private void sendSwapPacket(Int2ObjectMap<ItemStack> changedSlots, int buttonNum
507516
mc.player.networkHandler.sendPacket(new ClickSlotC2SPacket(
508517
syncId,
509518
stateId,
510-
6, // slotNum
511-
buttonNum, // the slot number thats being swapped
519+
6,
520+
buttonNum,
512521
SlotActionType.SWAP,
513522
new ItemStack(Items.AIR),
514523
changedSlots

0 commit comments

Comments
 (0)