From 1d215d41e81be7e35b5b88b5a0e667d737d18d8c Mon Sep 17 00:00:00 2001 From: 0xTas Date: Mon, 5 Aug 2024 17:49:04 -0700 Subject: [PATCH] RocketMan - Tweaked defaults since duration boost was patched. Added acceleration backoff threshold setting. --- .../mixin/FireworkRocketEntityMixin.java | 40 ++++++++++++------- .../dev/stardust/mixin/LivingEntityMixin.java | 14 +++++-- .../java/dev/stardust/modules/RocketMan.java | 27 ++++++++----- 3 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/main/java/dev/stardust/mixin/FireworkRocketEntityMixin.java b/src/main/java/dev/stardust/mixin/FireworkRocketEntityMixin.java index 726412f..da6976d 100644 --- a/src/main/java/dev/stardust/mixin/FireworkRocketEntityMixin.java +++ b/src/main/java/dev/stardust/mixin/FireworkRocketEntityMixin.java @@ -9,6 +9,7 @@ import net.minecraft.util.math.MathHelper; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import net.minecraft.entity.FlyingItemEntity; import com.llamalad7.mixinextras.sugar.Local; import org.spongepowered.asm.mixin.injection.At; @@ -30,13 +31,20 @@ public abstract class FireworkRocketEntityMixin implements FlyingItemEntity { @Shadow private @Nullable LivingEntity shooter; + @Unique + private @Nullable RocketMan rm; + // See RocketMan.java @Inject(method = "tick", at = @At("HEAD")) private void createTrackedRocketEntity(CallbackInfo ci) { if (this.shooter == null) return; - Modules modules = Modules.get(); - if (modules == null) return; - RocketMan rm = modules.get(RocketMan.class); + + if (this.rm == null) { + Modules modules = Modules.get(); + if (modules == null) return; + rm = modules.get(RocketMan.class); + } + if (!rm.getClientInstance().player.isFallFlying()) return; if (!this.shooter.getUuid().equals(rm.getClientInstance().player.getUuid())) return; if (!rm.isActive() || rm.currentRocket == (Object)this) return; @@ -60,10 +68,11 @@ private void createTrackedRocketEntity(CallbackInfo ci) { @ModifyConstant(method = "tick", constant = @Constant(doubleValue = 1.5)) private double boostFireworkRocketSpeed(double multiplier) { - Modules modules = Modules.get(); - if (modules == null) return multiplier; - - RocketMan rm = modules.get(RocketMan.class); + if (this.rm == null) { + Modules modules = Modules.get(); + if (modules == null) return multiplier; + rm = modules.get(RocketMan.class); + } if (!rm.isActive() || !rm.boostSpeed.get()) return multiplier; return rm.getRocketBoostAcceleration(); @@ -71,10 +80,11 @@ private double boostFireworkRocketSpeed(double multiplier) { @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;getVelocity()Lnet/minecraft/util/math/Vec3d;")) private void spoofRotationVector(CallbackInfo ci, @Local(ordinal = 0) LocalRef rotationVec) { - Modules modules = Modules.get(); - if (modules == null) return; - - RocketMan rm = modules.get(RocketMan.class); + if (this.rm == null) { + Modules modules = Modules.get(); + if (modules == null) return; + rm = modules.get(RocketMan.class); + } if (!rm.isActive() || !rm.shouldLockYLevel()) return; if (!rm.getClientInstance().player.isFallFlying() || !rm.hasActiveRocket) return; @@ -87,9 +97,11 @@ private void spoofRotationVector(CallbackInfo ci, @Local(ordinal = 0) LocalRef type, World world) { super(type, world); } + @Unique + @Nullable private RocketMan rm; + // See RocketMan.java @Inject(method = "travel", at = @At(value = "INVOKE", target = "Ljava/lang/Math;sqrt(D)D")) private void spoofPitchForSpeedCalcs(CallbackInfo ci, @Local(ordinal = 0) LocalFloatRef f, @Local(ordinal = 1)LocalRef rotationVec) { - Modules modules = Modules.get(); - if (modules == null) return; - RocketMan rm = modules.get(RocketMan.class); + if (this.rm == null) { + Modules modules = Modules.get(); + if (modules == null) return; + rm = modules.get(RocketMan.class); + } + if (!rm.isActive() || !rm.shouldLockYLevel()) return; if (!this.getUuid().equals(rm.getClientInstance().player.getUuid())) return; if (!rm.getClientInstance().player.isFallFlying() || !rm.hasActiveRocket) return; diff --git a/src/main/java/dev/stardust/modules/RocketMan.java b/src/main/java/dev/stardust/modules/RocketMan.java index fc85308..5c34c10 100644 --- a/src/main/java/dev/stardust/modules/RocketMan.java +++ b/src/main/java/dev/stardust/modules/RocketMan.java @@ -122,11 +122,19 @@ public enum RocketMode { OnForwardKey, Static, Dynamic } .build() ); + private final Setting rocketSpeedThreshold = sgBoosts.add( + new DoubleSetting.Builder() + .name("Acceleration Backoff Threshold") + .description("Backs down on acceleration when you've slowed down enough since using your last rocket (to prevent rubberbanding.)") + .min(0).max(2).defaultValue(.69) + .build() + ); + public final Setting extendRockets = sgBoosts.add( new BoolSetting.Builder() .name("Boost Rocket Duration") .description("Extend the duration of your rocket's boost effect.") - .defaultValue(true) + .defaultValue(false) .build() ); @@ -214,6 +222,14 @@ public enum RocketMode { OnForwardKey, Static, Dynamic } .build() ); + public final Setting forceRocketUsage = sgHover.add( + new BoolSetting.Builder() + .name("Force Rocket Usage") + .description("Force rocket usage when hovering.") + .defaultValue(true) + .build() + ); + public final Setting yLevelLock = sgControl.add( new BoolSetting.Builder() .name("Y Level Lock") @@ -422,13 +438,6 @@ public enum RocketMode { OnForwardKey, Static, Dynamic } .build() ); - private final Setting rocketSpeedThreshold = sgScroll.add( - new DoubleSetting.Builder() - .name("Rocket Accel Threshold (Debug)") - .min(0).max(2).defaultValue(.85) - .build() - ); - private int timer = 0; private int ticksBusy = 0; private int hoverTimer = 0; @@ -852,7 +861,7 @@ private void onTick(TickEvent.Pre event) { ++durabilityCheckTicks; if (hoverTimer == 2 && (!hasActiveRocket || durationBoosted)) { useFireworkRocket("hover initiate"); - } else if (!hasActiveRocket) useFireworkRocket("hover maintain"); + } else if (!hasActiveRocket && forceRocketUsage.get()) useFireworkRocket("hover maintain"); return; } else hoverTimer = 0;