Skip to content

Commit 1d215d4

Browse files
committed
RocketMan - Tweaked defaults since duration boost was patched. Added acceleration backoff threshold setting.
1 parent 335a647 commit 1d215d4

File tree

3 files changed

+55
-26
lines changed

3 files changed

+55
-26
lines changed

src/main/java/dev/stardust/mixin/FireworkRocketEntityMixin.java

+26-14
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.minecraft.util.math.MathHelper;
1010
import org.jetbrains.annotations.Nullable;
1111
import org.spongepowered.asm.mixin.Shadow;
12+
import org.spongepowered.asm.mixin.Unique;
1213
import net.minecraft.entity.FlyingItemEntity;
1314
import com.llamalad7.mixinextras.sugar.Local;
1415
import org.spongepowered.asm.mixin.injection.At;
@@ -30,13 +31,20 @@ public abstract class FireworkRocketEntityMixin implements FlyingItemEntity {
3031
@Shadow
3132
private @Nullable LivingEntity shooter;
3233

34+
@Unique
35+
private @Nullable RocketMan rm;
36+
3337
// See RocketMan.java
3438
@Inject(method = "tick", at = @At("HEAD"))
3539
private void createTrackedRocketEntity(CallbackInfo ci) {
3640
if (this.shooter == null) return;
37-
Modules modules = Modules.get();
38-
if (modules == null) return;
39-
RocketMan rm = modules.get(RocketMan.class);
41+
42+
if (this.rm == null) {
43+
Modules modules = Modules.get();
44+
if (modules == null) return;
45+
rm = modules.get(RocketMan.class);
46+
}
47+
4048
if (!rm.getClientInstance().player.isFallFlying()) return;
4149
if (!this.shooter.getUuid().equals(rm.getClientInstance().player.getUuid())) return;
4250
if (!rm.isActive() || rm.currentRocket == (Object)this) return;
@@ -60,21 +68,23 @@ private void createTrackedRocketEntity(CallbackInfo ci) {
6068

6169
@ModifyConstant(method = "tick", constant = @Constant(doubleValue = 1.5))
6270
private double boostFireworkRocketSpeed(double multiplier) {
63-
Modules modules = Modules.get();
64-
if (modules == null) return multiplier;
65-
66-
RocketMan rm = modules.get(RocketMan.class);
71+
if (this.rm == null) {
72+
Modules modules = Modules.get();
73+
if (modules == null) return multiplier;
74+
rm = modules.get(RocketMan.class);
75+
}
6776
if (!rm.isActive() || !rm.boostSpeed.get()) return multiplier;
6877

6978
return rm.getRocketBoostAcceleration();
7079
}
7180

7281
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getVelocity()Lnet/minecraft/util/math/Vec3d;"))
7382
private void spoofRotationVector(CallbackInfo ci, @Local(ordinal = 0) LocalRef<Vec3d> rotationVec) {
74-
Modules modules = Modules.get();
75-
if (modules == null) return;
76-
77-
RocketMan rm = modules.get(RocketMan.class);
83+
if (this.rm == null) {
84+
Modules modules = Modules.get();
85+
if (modules == null) return;
86+
rm = modules.get(RocketMan.class);
87+
}
7888
if (!rm.isActive() || !rm.shouldLockYLevel()) return;
7989
if (!rm.getClientInstance().player.isFallFlying() || !rm.hasActiveRocket) return;
8090

@@ -87,9 +97,11 @@ private void spoofRotationVector(CallbackInfo ci, @Local(ordinal = 0) LocalRef<V
8797

8898
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/FireworkRocketEntity;explodeAndRemove()V", shift = At.Shift.BEFORE), cancellable = true)
8999
private void extendFireworkDuration(CallbackInfo ci) {
90-
Modules modules = Modules.get();
91-
if (modules == null) return;
92-
RocketMan rm = modules.get(RocketMan.class);
100+
if (this.rm == null) {
101+
Modules modules = Modules.get();
102+
if (modules == null) return;
103+
rm = modules.get(RocketMan.class);
104+
}
93105
if (rm.currentRocket == null) return;
94106
if (!rm.isActive() || !rm.extendRockets.get()) return;
95107
if (rm.currentRocket.getId() != ((FireworkRocketEntity)(Object)this).getId()) return;

src/main/java/dev/stardust/mixin/LivingEntityMixin.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import net.minecraft.entity.EntityType;
99
import net.minecraft.entity.LivingEntity;
1010
import org.spongepowered.asm.mixin.Mixin;
11+
import org.jetbrains.annotations.Nullable;
12+
import org.spongepowered.asm.mixin.Unique;
1113
import com.llamalad7.mixinextras.sugar.Local;
1214
import org.spongepowered.asm.mixin.injection.At;
1315
import org.spongepowered.asm.mixin.injection.Inject;
@@ -23,12 +25,18 @@ public LivingEntityMixin(EntityType<?> type, World world) {
2325
super(type, world);
2426
}
2527

28+
@Unique
29+
@Nullable private RocketMan rm;
30+
2631
// See RocketMan.java
2732
@Inject(method = "travel", at = @At(value = "INVOKE", target = "Ljava/lang/Math;sqrt(D)D"))
2833
private void spoofPitchForSpeedCalcs(CallbackInfo ci, @Local(ordinal = 0) LocalFloatRef f, @Local(ordinal = 1)LocalRef<Vec3d> rotationVec) {
29-
Modules modules = Modules.get();
30-
if (modules == null) return;
31-
RocketMan rm = modules.get(RocketMan.class);
34+
if (this.rm == null) {
35+
Modules modules = Modules.get();
36+
if (modules == null) return;
37+
rm = modules.get(RocketMan.class);
38+
}
39+
3240
if (!rm.isActive() || !rm.shouldLockYLevel()) return;
3341
if (!this.getUuid().equals(rm.getClientInstance().player.getUuid())) return;
3442
if (!rm.getClientInstance().player.isFallFlying() || !rm.hasActiveRocket) return;

src/main/java/dev/stardust/modules/RocketMan.java

+18-9
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,19 @@ public enum RocketMode { OnForwardKey, Static, Dynamic }
122122
.build()
123123
);
124124

125+
private final Setting<Double> rocketSpeedThreshold = sgBoosts.add(
126+
new DoubleSetting.Builder()
127+
.name("Acceleration Backoff Threshold")
128+
.description("Backs down on acceleration when you've slowed down enough since using your last rocket (to prevent rubberbanding.)")
129+
.min(0).max(2).defaultValue(.69)
130+
.build()
131+
);
132+
125133
public final Setting<Boolean> extendRockets = sgBoosts.add(
126134
new BoolSetting.Builder()
127135
.name("Boost Rocket Duration")
128136
.description("Extend the duration of your rocket's boost effect.")
129-
.defaultValue(true)
137+
.defaultValue(false)
130138
.build()
131139
);
132140

@@ -214,6 +222,14 @@ public enum RocketMode { OnForwardKey, Static, Dynamic }
214222
.build()
215223
);
216224

225+
public final Setting<Boolean> forceRocketUsage = sgHover.add(
226+
new BoolSetting.Builder()
227+
.name("Force Rocket Usage")
228+
.description("Force rocket usage when hovering.")
229+
.defaultValue(true)
230+
.build()
231+
);
232+
217233
public final Setting<Boolean> yLevelLock = sgControl.add(
218234
new BoolSetting.Builder()
219235
.name("Y Level Lock")
@@ -422,13 +438,6 @@ public enum RocketMode { OnForwardKey, Static, Dynamic }
422438
.build()
423439
);
424440

425-
private final Setting<Double> rocketSpeedThreshold = sgScroll.add(
426-
new DoubleSetting.Builder()
427-
.name("Rocket Accel Threshold (Debug)")
428-
.min(0).max(2).defaultValue(.85)
429-
.build()
430-
);
431-
432441
private int timer = 0;
433442
private int ticksBusy = 0;
434443
private int hoverTimer = 0;
@@ -852,7 +861,7 @@ private void onTick(TickEvent.Pre event) {
852861
++durabilityCheckTicks;
853862
if (hoverTimer == 2 && (!hasActiveRocket || durationBoosted)) {
854863
useFireworkRocket("hover initiate");
855-
} else if (!hasActiveRocket) useFireworkRocket("hover maintain");
864+
} else if (!hasActiveRocket && forceRocketUsage.get()) useFireworkRocket("hover maintain");
856865
return;
857866
} else hoverTimer = 0;
858867

0 commit comments

Comments
 (0)