diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..87018dbc Binary files /dev/null and b/.gitignore differ diff --git a/common/java/com/zergatul/cheatutils/configs/AreaMineConfig.java b/common/java/com/zergatul/cheatutils/configs/AreaMineConfig.java index 7d1330c0..6fb1a38d 100644 --- a/common/java/com/zergatul/cheatutils/configs/AreaMineConfig.java +++ b/common/java/com/zergatul/cheatutils/configs/AreaMineConfig.java @@ -15,4 +15,4 @@ public AreaMineConfig() { public void sanitize() { radius = MathUtils.clamp(radius, 1, 20); } -} \ No newline at end of file +} diff --git a/common/java/com/zergatul/cheatutils/configs/BoatHackConfig.java b/common/java/com/zergatul/cheatutils/configs/BoatHackConfig.java index 1533fcc8..743dd5b9 100644 --- a/common/java/com/zergatul/cheatutils/configs/BoatHackConfig.java +++ b/common/java/com/zergatul/cheatutils/configs/BoatHackConfig.java @@ -23,4 +23,4 @@ public void sanitize() { public boolean isEnabled() { return fly; } -} \ No newline at end of file +} diff --git a/common/java/com/zergatul/cheatutils/configs/Config.java b/common/java/com/zergatul/cheatutils/configs/Config.java index 027830da..d1d3d0bc 100644 --- a/common/java/com/zergatul/cheatutils/configs/Config.java +++ b/common/java/com/zergatul/cheatutils/configs/Config.java @@ -79,6 +79,7 @@ public class Config implements Sanitizable { public HandsViewConfig handsViewConfig = new HandsViewConfig(); public PrivacyConfig privacyConfig = new PrivacyConfig(); public CrystalAuraConfig crystalAuraConfig = new CrystalAuraConfig(); + public PhysicsConfig physicsConfig = new PhysicsConfig(); @Override public void sanitize() { diff --git a/common/java/com/zergatul/cheatutils/configs/MovementHackConfig.java b/common/java/com/zergatul/cheatutils/configs/MovementHackConfig.java index 073da82d..2952646b 100644 --- a/common/java/com/zergatul/cheatutils/configs/MovementHackConfig.java +++ b/common/java/com/zergatul/cheatutils/configs/MovementHackConfig.java @@ -27,4 +27,4 @@ public void sanitize() { public boolean isEnabled() { return disableSlowdownOnUseItem || scaleInputVector || disableCrouchingSlowdown || antiKnockback || antiPush || scaleJumpHeight || disableWaterPush; } -} \ No newline at end of file +} diff --git a/common/java/com/zergatul/cheatutils/configs/PhysicsConfig.java b/common/java/com/zergatul/cheatutils/configs/PhysicsConfig.java new file mode 100644 index 00000000..de8f0e88 --- /dev/null +++ b/common/java/com/zergatul/cheatutils/configs/PhysicsConfig.java @@ -0,0 +1,43 @@ +package com.zergatul.cheatutils.configs; + +public class PhysicsConfig extends ModuleConfig implements Sanitizable { + + // === Fricción existente === + public double playerFriction; + public double boatFriction; + public boolean overridePlayerFriction; + public boolean overrideBoatFriction; + + // === NUEVO: Dirección del bote === + public boolean followLookDirection; + public double lookSpeed; + public boolean verticalMode; + public double verticalSpeed; + public boolean passengerControls; + + + public PhysicsConfig() { + playerFriction = 1f; + boatFriction = 0.6f; + overrideBoatFriction = false; + overridePlayerFriction = false; + + passengerControls = false; + followLookDirection = false; + lookSpeed = 0.3; + verticalMode = false; + verticalSpeed = 0.2; + + + } + + @Override + public void sanitize() { + if (playerFriction < 0) playerFriction = 0; + if (boatFriction < 0) boatFriction = 0; + if (lookSpeed < 0) lookSpeed = 0; + if (lookSpeed > 2) lookSpeed = 2; + if (verticalSpeed < 0) verticalSpeed = 0; + if (verticalSpeed > 1) verticalSpeed = 1; + } +} \ No newline at end of file diff --git a/common/java/com/zergatul/cheatutils/mixins/common/MixinPhysicsBoat.java b/common/java/com/zergatul/cheatutils/mixins/common/MixinPhysicsBoat.java new file mode 100644 index 00000000..82666742 --- /dev/null +++ b/common/java/com/zergatul/cheatutils/mixins/common/MixinPhysicsBoat.java @@ -0,0 +1,113 @@ +package com.zergatul.cheatutils.mixins.common; + +import com.zergatul.cheatutils.configs.ConfigStore; +import com.zergatul.cheatutils.configs.PhysicsConfig; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.vehicle.boat.AbstractBoat; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +@Mixin(AbstractBoat.class) +public abstract class MixinPhysicsBoat extends Entity { + + @Shadow private boolean inputLeft; + @Shadow private boolean inputRight; + @Shadow private boolean inputUp; + @Shadow private boolean inputDown; + @Shadow private boolean isAboveBubbleColumn; + @Shadow private boolean bubbleColumnDirectionIsDown; + + public MixinPhysicsBoat(EntityType type, Level level) { + super(type, level); + } + + @Inject(method = "getGroundFriction", at = @At("RETURN"), cancellable = true) + private void onGetGroundFriction(CallbackInfoReturnable cir) { + PhysicsConfig config = ConfigStore.instance.getConfig().physicsConfig; + if (config.overrideBoatFriction) { + cir.setReturnValue((float) config.boatFriction); + } + } + + @Inject(method = "setInput", at = @At("HEAD"), cancellable = true) + private void onSetInput(boolean left, boolean right, boolean up, boolean down, CallbackInfo ci) { + if (!this.level().isClientSide()) return; + Entity controller = this.getControllingPassenger(); + if (!(controller instanceof Player)) return; + + PhysicsConfig config = ConfigStore.instance.getConfig().physicsConfig; + if (!config.followLookDirection) return; + + LivingEntity target = getTargetEntity(config, controller); + if (target == null) return; + + float yaw = target.getYRot(); + float boatYaw = this.getYRot(); + float deltaYaw = Mth.wrapDegrees(yaw - boatYaw); + + this.inputLeft = deltaYaw < -15; + this.inputRight = deltaYaw > 15; + this.inputUp = Math.abs(deltaYaw) < 90; + this.inputDown = false; + + this.isAboveBubbleColumn = true; + this.bubbleColumnDirectionIsDown = target.getXRot() > 10; + + ci.cancel(); + } + + @Inject(method = "tick", at = @At("TAIL")) + private void onTickTail(CallbackInfo ci) { + if (!this.level().isClientSide()) return; + Entity controller = this.getControllingPassenger(); + if (!(controller instanceof Player)) return; + + PhysicsConfig config = ConfigStore.instance.getConfig().physicsConfig; + if (!config.followLookDirection) return; + + LivingEntity target = getTargetEntity(config, controller); + if (target == null) return; + + Vec3 movement = this.getDeltaMovement(); + + // === VELOCIDAD HORIZONTAL === + if (this.inputUp) { + double currentSpeed = Math.sqrt(movement.x * movement.x + movement.z * movement.z); + if (currentSpeed > 0.001) { + double scale = config.lookSpeed / currentSpeed; + this.setDeltaMovement(movement.x * scale, movement.y, movement.z * scale); + } + } + + // === VERTICAL === + if (config.verticalMode) { + float pitch = target.getXRot(); + Vec3 current = this.getDeltaMovement(); + double my; + if (pitch < -10) my = config.verticalSpeed + 0.15; + else if (pitch > 10) my = -config.verticalSpeed; + else my = 0.04; + this.setDeltaMovement(current.x, my, current.z); + } + } + + private LivingEntity getTargetEntity(PhysicsConfig config, Entity controller) { + if (config.passengerControls) { + for (Entity passenger : this.getPassengers()) { + if (passenger != controller && passenger instanceof LivingEntity living) { + return living; + } + } + } + return controller instanceof LivingEntity living ? living : null; + } +} \ No newline at end of file diff --git a/common/java/com/zergatul/cheatutils/mixins/common/MixinPhysicsPlayer.java b/common/java/com/zergatul/cheatutils/mixins/common/MixinPhysicsPlayer.java new file mode 100644 index 00000000..5a67b0ff --- /dev/null +++ b/common/java/com/zergatul/cheatutils/mixins/common/MixinPhysicsPlayer.java @@ -0,0 +1,28 @@ +package com.zergatul.cheatutils.mixins.common; + +import com.zergatul.cheatutils.configs.ConfigStore; +import com.zergatul.cheatutils.configs.PhysicsConfig; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(LivingEntity.class) +public class MixinPhysicsPlayer { + + @ModifyVariable( + method = "travelInAir", + at = @At(value = "STORE", ordinal = 0) + ) + private float modifyBlockFriction(float original) { + PhysicsConfig config = ConfigStore.instance.getConfig().physicsConfig; + + LivingEntity entity = (LivingEntity) (Object) this; + if (entity instanceof Player && config.overridePlayerFriction) { + return (float) config.playerFriction; + } + + return original; + } +} \ No newline at end of file diff --git a/common/java/com/zergatul/cheatutils/modules/Modules.java b/common/java/com/zergatul/cheatutils/modules/Modules.java index 10a142c9..836f42ba 100644 --- a/common/java/com/zergatul/cheatutils/modules/Modules.java +++ b/common/java/com/zergatul/cheatutils/modules/Modules.java @@ -81,9 +81,11 @@ public static void register() { register(LogoutSpots.instance); register(AutoTool.instance); register(AirPlace.instance); +// register(Physics.instance); register(ContainerSummary.instance); register(CrystalAura.instance); + register(TickEndExecutor.instance); // new order independent modules diff --git a/common/java/com/zergatul/cheatutils/modules/hacks/Physics.java b/common/java/com/zergatul/cheatutils/modules/hacks/Physics.java new file mode 100644 index 00000000..d51f25da --- /dev/null +++ b/common/java/com/zergatul/cheatutils/modules/hacks/Physics.java @@ -0,0 +1,14 @@ +package com.zergatul.cheatutils.modules.hacks; +import com.zergatul.cheatutils.modules.Module; +import net.minecraft.client.Minecraft; + +public class Physics implements Module { + public static final Physics instance = new Physics(); + + private static final Minecraft mc = Minecraft.getInstance(); + + private Physics() {} + + + +} \ No newline at end of file diff --git a/common/java/com/zergatul/cheatutils/scripting/Root.java b/common/java/com/zergatul/cheatutils/scripting/Root.java index f66c5bbc..847fd0fb 100644 --- a/common/java/com/zergatul/cheatutils/scripting/Root.java +++ b/common/java/com/zergatul/cheatutils/scripting/Root.java @@ -51,6 +51,7 @@ public class Root { public static AimAssistApi aimAssist = new AimAssistApi(); public static AirPlaceApi airPlace = new AirPlaceApi(); public static CrystalAuraApi crystalAura = new CrystalAuraApi(); + public static PhysicsApi physics = new PhysicsApi(); // visuals public static ArmorOverlayApi armorOverlay = new ArmorOverlayApi(); diff --git a/common/java/com/zergatul/cheatutils/scripting/modules/PhysicsApi.java b/common/java/com/zergatul/cheatutils/scripting/modules/PhysicsApi.java new file mode 100644 index 00000000..fd35f4e8 --- /dev/null +++ b/common/java/com/zergatul/cheatutils/scripting/modules/PhysicsApi.java @@ -0,0 +1,99 @@ +package com.zergatul.cheatutils.scripting.modules; + +import com.zergatul.cheatutils.configs.ConfigStore; +import com.zergatul.cheatutils.configs.PhysicsConfig; +import com.zergatul.cheatutils.scripting.ApiType; +import com.zergatul.cheatutils.scripting.ApiVisibility; +import com.zergatul.scripting.MethodDescription; + +@SuppressWarnings("unused") +public class PhysicsApi extends ModuleApi { + + @Override + protected PhysicsConfig getConfig() { + return ConfigStore.instance.getConfig().physicsConfig; + } + + // === Métodos personalizados para scripting === + + @MethodDescription("Gets player friction value") + public double getPlayerFriction() { + return getConfig().playerFriction; + } + + @MethodDescription("Sets player friction value") + @ApiVisibility(ApiType.UPDATE) + public void setPlayerFriction(double value) { + getConfig().playerFriction = value; + ConfigStore.instance.requestWrite(); + } + + @MethodDescription("Gets boat friction value") + public double getBoatFriction() { + return getConfig().boatFriction; + } + + @MethodDescription("Sets boat friction value") + @ApiVisibility(ApiType.UPDATE) + public void setBoatFriction(double value) { + getConfig().boatFriction = value; + ConfigStore.instance.requestWrite(); + } + + @MethodDescription("Checks if player friction override is enabled") + public boolean isOverridePlayerFriction() { + return getConfig().overridePlayerFriction; + } + + @MethodDescription("Sets player friction override") + @ApiVisibility(ApiType.UPDATE) + public void setOverridePlayerFriction(boolean value) { + getConfig().overridePlayerFriction = value; + ConfigStore.instance.requestWrite(); + } + + @MethodDescription("Checks if boat friction override is enabled") + public boolean isOverrideBoatFriction() { + return getConfig().overrideBoatFriction; + } + + @MethodDescription("Sets boat friction override") + @ApiVisibility(ApiType.UPDATE) + public void setOverrideBoatFriction(boolean value) { + getConfig().overrideBoatFriction = value; + ConfigStore.instance.requestWrite(); + } + + @MethodDescription("Checks if boat follows look direction") + public boolean isFollowLookDirection() { + return getConfig().followLookDirection; + } + + @MethodDescription("Sets boat follow look direction") + @ApiVisibility(ApiType.UPDATE) + public void setFollowLookDirection(boolean value) { + getConfig().followLookDirection = value; + ConfigStore.instance.requestWrite(); + } + + @MethodDescription("Gets look direction speed") + public double getLookSpeed() { + return getConfig().lookSpeed; + } + + @MethodDescription("Sets look direction speed") + @ApiVisibility(ApiType.UPDATE) + public void setLookSpeed(double value) { + getConfig().lookSpeed = value; + ConfigStore.instance.requestWrite(); + } + + public boolean isPassengerControls() { + return getConfig().passengerControls; + } + + public void setPassengerControls(boolean passengerControls) { + getConfig().passengerControls = passengerControls; + ConfigStore.instance.requestWrite(); + } +} \ No newline at end of file diff --git a/common/java/com/zergatul/cheatutils/webui/ApiHandler.java b/common/java/com/zergatul/cheatutils/webui/ApiHandler.java index 22f1e370..030e032b 100644 --- a/common/java/com/zergatul/cheatutils/webui/ApiHandler.java +++ b/common/java/com/zergatul/cheatutils/webui/ApiHandler.java @@ -29,6 +29,7 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; +import com.zergatul.cheatutils.configs.PhysicsConfig; public class ApiHandler implements HttpHandler { @@ -985,6 +986,18 @@ protected void setConfig(ParkourAssistConfig config) { } }); + apis.add(new SimpleConfigApi<>("physics", PhysicsConfig.class) { + @Override + protected PhysicsConfig getConfig() { + return ConfigStore.instance.getConfig().physicsConfig; + } + + @Override + protected void setConfig(PhysicsConfig config) { + ConfigStore.instance.getConfig().physicsConfig = config; + } + }); + apis.add(new SimpleConfigApi<>("hands-view", HandsViewConfig.class) { @Override protected HandsViewConfig getConfig() { diff --git a/common/resources/cheatutils.common.mixins.json b/common/resources/cheatutils.common.mixins.json index 4c4daf31..844afd38 100644 --- a/common/resources/cheatutils.common.mixins.json +++ b/common/resources/cheatutils.common.mixins.json @@ -40,7 +40,8 @@ "common.schematics.MixinRenderRegionCache", "common.schematics.MixinRenderSectionRegion", "common.schematics.MixinSectionOcclusionGraph", - + "common.MixinPhysicsPlayer", + "common.MixinPhysicsBoat", "common.MixinAbstractBoat", "common.MixinAbstractContainerMenu", "common.MixinAbstractContainerScreen", diff --git a/common/resources/web/components/hacks/Physics.html b/common/resources/web/components/hacks/Physics.html new file mode 100644 index 00000000..f78c40ea --- /dev/null +++ b/common/resources/web/components/hacks/Physics.html @@ -0,0 +1,69 @@ +
+
+ Modify physics behavior for player and boat movement. +
+ +
+ +
+ + Override Boat Friction + +
+ Friction: + +
+
+ Regular blocks = 0.6, Packed ice = 0.98. +
+
+ +
+ + Override Player Friction + +
+ Friction: + +
+
+ + +
+ + Boat Follows Look Direction + + + +
+ Controlled by: + +
+ +
+ Speed: + +
+
+ Boat moves in the direction someone is looking. Toggle between driver or passenger. +
+
+ + +
+ + Bubble Column Mode (Vertical) + +
+ Vertical Speed: + +
+
+ Look up to rise, look down to sink. Like a soul sand bubble column! +
+
+
+
\ No newline at end of file diff --git a/common/resources/web/components/hacks/Physics.js b/common/resources/web/components/hacks/Physics.js new file mode 100644 index 00000000..361e1946 --- /dev/null +++ b/common/resources/web/components/hacks/Physics.js @@ -0,0 +1,5 @@ +import { createSimpleComponent } from '/components/SimpleModule.js' + +export function createComponent(template) { + return createSimpleComponent('/api/physics', template); +} \ No newline at end of file diff --git a/common/resources/web/modules.js b/common/resources/web/modules.js index ab594c4a..511d43b0 100644 --- a/common/resources/web/modules.js +++ b/common/resources/web/modules.js @@ -391,6 +391,14 @@ module({ tags: ['kill', 'crystal', 'aura', 'auto', 'attack', 'blow', 'explode'] }); +module({ + group: 'hacks', + name: 'Physics', + component: 'Physics', + path: 'physics', + tags: ['physics', 'friction', 'player', 'boat', 'movement'] +}); + // Visuals Modules ============================ module({