-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RocketMan - Massive rework, removed trident integration, added rocket…
… speed & duration boosts, & various hover modes.
- Loading branch information
Showing
12 changed files
with
1,017 additions
and
354 deletions.
There are no files selected for viewing
27 changes: 0 additions & 27 deletions
27
src/main/java/dev/stardust/mixin/ClientPlayerInteractionManagerMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package dev.stardust.mixin; | ||
|
||
import java.util.UUID; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.Nameable; | ||
import net.minecraft.util.math.Vec3d; | ||
import dev.stardust.modules.RocketMan; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import net.minecraft.world.entity.EntityLike; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import net.minecraft.server.command.CommandOutput; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
import meteordevelopment.meteorclient.systems.modules.Modules; | ||
|
||
@Mixin(Entity.class) | ||
public abstract class EntityMixin | ||
implements Nameable, EntityLike, CommandOutput { | ||
|
||
@Shadow | ||
public abstract UUID getUuid(); | ||
|
||
// See RocketMan.java | ||
@ModifyVariable(method = "setVelocity(Lnet/minecraft/util/math/Vec3d;)V", at = @At("HEAD"), argsOnly = true) | ||
private Vec3d spoofYMovement(Vec3d velocity) { | ||
Modules modules = Modules.get(); | ||
if (modules == null) return velocity; | ||
RocketMan rm = modules.get(RocketMan.class); | ||
if (!rm.isActive() || !rm.shouldLockYLevel()) return velocity; | ||
if (!this.getUuid().equals(rm.getClientInstance().player.getUuid())) return velocity; | ||
if (!rm.getClientInstance().player.isFallFlying() || !rm.hasActiveRocket) return velocity; | ||
|
||
Vec3d spoofVec; | ||
if (rm.getClientInstance().player.input.jumping) { | ||
spoofVec = new Vec3d(velocity.x, rm.verticalSpeed.get(), velocity.z); | ||
} else if (rm.getClientInstance().player.input.sneaking) { | ||
spoofVec = new Vec3d(velocity.x, -rm.verticalSpeed.get(), velocity.z); | ||
} else spoofVec = new Vec3d(velocity.x, 0, velocity.z); | ||
|
||
return spoofVec; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/dev/stardust/mixin/FireworkRocketEntityAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.stardust.mixin; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
import net.minecraft.entity.projectile.FireworkRocketEntity; | ||
|
||
@Mixin(FireworkRocketEntity.class) | ||
public interface FireworkRocketEntityAccessor { | ||
@Invoker("explodeAndRemove") | ||
void invokeExplodeAndRemove(); | ||
} |
99 changes: 99 additions & 0 deletions
99
src/main/java/dev/stardust/mixin/FireworkRocketEntityMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package dev.stardust.mixin; | ||
|
||
import net.minecraft.text.Text; | ||
import net.minecraft.util.math.Vec3d; | ||
import dev.stardust.modules.RocketMan; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.entity.LivingEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import net.minecraft.util.math.MathHelper; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import net.minecraft.entity.FlyingItemEntity; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalRef; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.entity.projectile.FireworkRocketEntity; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
import meteordevelopment.meteorclient.systems.modules.Modules; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
/** | ||
* @author Tas [0xTas] <[email protected]> | ||
**/ | ||
@Mixin(value = FireworkRocketEntity.class) | ||
public abstract class FireworkRocketEntityMixin implements FlyingItemEntity { | ||
|
||
@Shadow | ||
private @Nullable LivingEntity shooter; | ||
|
||
// 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 (!rm.getClientInstance().player.isFallFlying()) return; | ||
if (!this.shooter.getUuid().equals(rm.getClientInstance().player.getUuid())) return; | ||
if (!rm.isActive() || rm.currentRocket == (Object)this) return; | ||
|
||
ClientPlayerEntity player = rm.getClientInstance().player; | ||
if (rm.currentRocket != null) { | ||
if (rm.currentRocket.getId() != ((FireworkRocketEntity)(Object)this).getId()) { | ||
rm.discardCurrentRocket("overwrite current"); | ||
|
||
rm.hasActiveRocket = true; | ||
rm.currentRocket = (FireworkRocketEntity)(Object)this; | ||
rm.extensionStartPos = new BlockPos(player.getBlockX(), 0, player.getBlockZ()); | ||
} | ||
} else { | ||
rm.hasActiveRocket = true; | ||
rm.currentRocket = (FireworkRocketEntity)(Object)this; | ||
rm.extensionStartPos = new BlockPos(player.getBlockX(), 0, player.getBlockZ()); | ||
if (rm.debug.get()) player.sendMessage(Text.literal("§7Created tracked rocket entity!")); | ||
} | ||
} | ||
|
||
@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 (!rm.isActive() || !rm.boostSpeed.get()) return multiplier; | ||
|
||
return rm.getRocketBoostAcceleration(); | ||
} | ||
|
||
@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<Vec3d> rotationVec) { | ||
Modules modules = Modules.get(); | ||
if (modules == null) return; | ||
|
||
RocketMan rm = modules.get(RocketMan.class); | ||
if (!rm.isActive() || !rm.shouldLockYLevel()) return; | ||
if (!rm.getClientInstance().player.isFallFlying() || !rm.hasActiveRocket) return; | ||
|
||
float g = -rm.getClientInstance().player.getYaw() * ((float)Math.PI / 180); | ||
float h = MathHelper.cos(g); | ||
float i = MathHelper.sin(g); | ||
|
||
rotationVec.set(new Vec3d(i, -1, h)); | ||
} | ||
|
||
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/projectile/FireworkRocketEntity;explodeAndRemove()V", shift = At.Shift.BEFORE), cancellable = true) | ||
private void extendFireworkDuration(CallbackInfo ci) { | ||
Modules modules = Modules.get(); | ||
if (modules == null) return; | ||
RocketMan rm = modules.get(RocketMan.class); | ||
if (rm.currentRocket == null) return; | ||
if (!rm.isActive() || !rm.extendRockets.get()) return; | ||
if (rm.currentRocket.getId() != ((FireworkRocketEntity)(Object)this).getId()) return; | ||
if (rm.debug.get()) rm.getClientInstance().player.sendMessage(Text.literal("§7Cancelling natural rocket expiration!")); | ||
ci.cancel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package dev.stardust.mixin; | ||
|
||
import net.minecraft.world.World; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.math.Vec3d; | ||
import dev.stardust.modules.RocketMan; | ||
import net.minecraft.entity.Attackable; | ||
import net.minecraft.entity.EntityType; | ||
import net.minecraft.entity.LivingEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalRef; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalFloatRef; | ||
import meteordevelopment.meteorclient.systems.modules.Modules; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(LivingEntity.class) | ||
public abstract class LivingEntityMixin extends Entity | ||
implements Attackable { | ||
public LivingEntityMixin(EntityType<?> type, World world) { | ||
super(type, world); | ||
} | ||
|
||
// 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<Vec3d> rotationVec) { | ||
Modules modules = Modules.get(); | ||
if (modules == null) return; | ||
RocketMan 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; | ||
|
||
if (rm.getClientInstance().player.input.jumping && rm.verticalSpeed.get() > 0) { | ||
f.set(-45); | ||
rotationVec.set(this.getRotationVector(45, this.getYaw())); | ||
} else if (rm.getClientInstance().player.input.sneaking && rm.verticalSpeed.get() > 0) { | ||
f.set(45); | ||
rotationVec.set(this.getRotationVector(45, this.getYaw())); | ||
} else { | ||
f.set(0); | ||
rotationVec.set(this.getRotationVector(0, this.getYaw())); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package dev.stardust.mixin; | ||
|
||
import org.lwjgl.glfw.GLFW; | ||
import dev.stardust.modules.RocketMan; | ||
import net.minecraft.sound.MusicSound; | ||
import dev.stardust.modules.MusicTweaks; | ||
|
@@ -8,11 +9,11 @@ | |
import net.minecraft.client.MinecraftClient; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import meteordevelopment.meteorclient.utils.misc.input.Input; | ||
import meteordevelopment.meteorclient.systems.modules.Modules; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
|
||
/** | ||
* @author Tas [0xTas] <[email protected]> | ||
**/ | ||
|
@@ -35,69 +36,68 @@ private void mixinRender(CallbackInfo ci) { | |
MinecraftClient mc = rocketMan.getClientInstance(); | ||
|
||
if (mc.player == null) return; | ||
String mode = rocketMan.getUsageMode(); | ||
|
||
switch (mode) { | ||
case "W Key" -> { | ||
if (mc.player.input.sneaking) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (mc.player.input.jumping) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} | ||
|
||
if (mc.player.input.pressingRight) { | ||
mc.player.changeLookDirection(rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} else if (mc.player.input.pressingLeft) { | ||
mc.player.changeLookDirection(-rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} | ||
if (!rocketMan.hoverMode.get().equals(RocketMan.HoverMode.Off)) { | ||
if (mc.player.input.sneaking && !rocketMan.shouldLockYLevel() && !rocketMan.isHovering) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (mc.player.input.jumping && !rocketMan.shouldLockYLevel() && !rocketMan.isHovering) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_UP)) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_DOWN)) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} | ||
case "Spacebar" -> { | ||
boolean inverted = rocketMan.shouldInvertPitch(); | ||
} else { | ||
boolean inverted = rocketMan.shouldInvertPitch(); | ||
RocketMan.RocketMode mode = rocketMan.usageMode.get(); | ||
|
||
if (inverted) { | ||
if (mc.player.input.pressingForward || mc.player.input.sneaking) { | ||
switch (mode) { | ||
case OnForwardKey -> { | ||
if (mc.player.input.sneaking) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (mc.player.input.pressingBack) { | ||
} else if (mc.player.input.jumping) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} | ||
} else { | ||
if (mc.player.input.pressingBack || mc.player.input.sneaking) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (mc.player.input.pressingForward) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} | ||
} | ||
|
||
if (mc.player.input.pressingRight) { | ||
mc.player.changeLookDirection(rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} else if (mc.player.input.pressingLeft) { | ||
mc.player.changeLookDirection(-rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} | ||
} | ||
case "Auto Use" -> { | ||
boolean inverted = rocketMan.shouldInvertPitch(); | ||
|
||
if (inverted) { | ||
if (mc.player.input.pressingForward || mc.player.input.sneaking) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (mc.player.input.pressingBack || mc.player.input.jumping) { | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_UP)) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} | ||
} else { | ||
if (mc.player.input.pressingBack || mc.player.input.sneaking) { | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_DOWN)) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (mc.player.input.pressingForward || mc.player.input.jumping) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} | ||
} | ||
|
||
if (mc.player.input.pressingRight) { | ||
mc.player.changeLookDirection(rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} else if (mc.player.input.pressingLeft) { | ||
mc.player.changeLookDirection(-rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
case Static, Dynamic -> { | ||
if (inverted) { | ||
if ((mc.player.input.pressingForward || mc.player.input.sneaking) && !rocketMan.shouldLockYLevel()) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} else if ((mc.player.input.pressingBack || mc.player.input.jumping) && !rocketMan.shouldLockYLevel()) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_DOWN)) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_UP)) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} | ||
} else { | ||
if ((mc.player.input.pressingBack || mc.player.input.sneaking) && !rocketMan.shouldLockYLevel()) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} else if ((mc.player.input.pressingForward || mc.player.input.jumping) && !rocketMan.shouldLockYLevel()) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
}else if (Input.isKeyPressed(GLFW.GLFW_KEY_UP)) { | ||
mc.player.changeLookDirection(0.0f, -rocketMan.getPitchSpeed() * deltaTime); | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_DOWN)) { | ||
mc.player.changeLookDirection(0.0f, rocketMan.getPitchSpeed() * deltaTime); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (mc.player.input.pressingRight && !rocketMan.isHovering) { | ||
mc.player.changeLookDirection(rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} else if (mc.player.input.pressingLeft && !rocketMan.isHovering) { | ||
mc.player.changeLookDirection(-rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_RIGHT)) { | ||
mc.player.changeLookDirection(rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} else if (Input.isKeyPressed(GLFW.GLFW_KEY_LEFT)) { | ||
mc.player.changeLookDirection(-rocketMan.getYawSpeed() * deltaTime, 0.0f); | ||
} | ||
|
||
lastFrameTime = currentTime; | ||
} | ||
|
||
|
Oops, something went wrong.