Skip to content

Commit

Permalink
added autosneak, noblindness
Browse files Browse the repository at this point in the history
  • Loading branch information
SymoHTL committed Apr 18, 2024
1 parent 00f7d2a commit 6c2d294
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 65 deletions.
20 changes: 0 additions & 20 deletions src/client/java/dev/symo/finz/events/KeyEvent.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package dev.symo.finz.mixin.client;

import com.mojang.authlib.GameProfile;
import dev.symo.finz.FinZClient;
import dev.symo.finz.events.impl.EventManager;
import dev.symo.finz.events.listeners.KnockbackListener;
import dev.symo.finz.modules.Modules;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.MovementType;
import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
Expand All @@ -19,11 +20,7 @@ public class ClientPlayerEntityMixin extends AbstractClientPlayerEntity {
@Final
protected MinecraftClient client;

private Screen tempCurrentScreen;
private boolean hideNextItemUse;

public ClientPlayerEntityMixin(FinZClient finz, ClientWorld world,
GameProfile profile) {
public ClientPlayerEntityMixin(ClientWorld world, GameProfile profile) {
super(world, profile);
}

Expand All @@ -34,5 +31,21 @@ public void setVelocityClient(double x, double y, double z) {
EventManager.fire(event);
super.setVelocityClient(event.getX(), event.getY(), event.getZ());
}


@Override
protected boolean clipAtLedge() {
return super.clipAtLedge() || Modules.autoSneak.isEnabled();
}

@Override
protected Vec3d adjustMovementForSneaking(Vec3d movement, MovementType type) {
Vec3d result = super.adjustMovementForSneaking(movement, type);

if (movement != null)
Modules.autoSneak.sneak(!movement.equals(result));

return result;
}
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dev.symo.finz.mixin.client;

import dev.symo.finz.tracker.BreakProgressTracker;
import dev.symo.finz.mixininterfaces.BreakProgressTracker;
import net.fabricmc.api.Environment;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.util.math.MathHelper;
Expand Down
20 changes: 0 additions & 20 deletions src/client/java/dev/symo/finz/mixin/client/InputEventMixin.java

This file was deleted.

31 changes: 31 additions & 0 deletions src/client/java/dev/symo/finz/mixin/client/KeyBindingMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package dev.symo.finz.mixin.client;

import dev.symo.finz.FinZClient;
import dev.symo.finz.mixininterfaces.IKeyBind;
import net.fabricmc.api.Environment;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

@Environment(net.fabricmc.api.EnvType.CLIENT)
@Mixin(KeyBinding.class)
public abstract class KeyBindingMixin implements IKeyBind {
@Shadow
private InputUtil.Key boundKey;

@Override
public boolean isActallyPressed() {
long handle = FinZClient.mc.getWindow().getHandle();
int code = boundKey.getCode();
return InputUtil.isKeyPressed(handle, code);
}

@Override
public void resetPressedState() {
setPressed(isActallyPressed());
}

@Shadow
public abstract void setPressed(boolean pressed);
}
20 changes: 20 additions & 0 deletions src/client/java/dev/symo/finz/mixin/client/WorldRendererMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package dev.symo.finz.mixin.client;

import dev.symo.finz.modules.Modules;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.WorldRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(WorldRenderer.class)
public class WorldRendererMixin {
@Inject(at = @At("HEAD"),
method = "hasBlindnessOrDarkness(Lnet/minecraft/client/render/Camera;)Z",
cancellable = true)
private void onHasBlindnessOrDarkness(Camera camera, CallbackInfoReturnable<Boolean> ci) {
if (Modules.noBlindness.isEnabled())
ci.setReturnValue(false);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package dev.symo.finz.tracker;
package dev.symo.finz.mixininterfaces;

public interface BreakProgressTracker {
float getBreakProgress(float tickDelta);
Expand Down
7 changes: 7 additions & 0 deletions src/client/java/dev/symo/finz/mixininterfaces/IKeyBind.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dev.symo.finz.mixininterfaces;

public interface IKeyBind {
boolean isActallyPressed();

void resetPressedState();
}
17 changes: 4 additions & 13 deletions src/client/java/dev/symo/finz/modules/ModuleManager.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.symo.finz.modules;

import dev.symo.finz.FinZClient;
import dev.symo.finz.events.KeyEvent;
import dev.symo.finz.events.impl.EventManager;
import dev.symo.finz.events.listeners.HudRenderListener;
import dev.symo.finz.events.listeners.TickListener;
Expand All @@ -14,8 +13,6 @@
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.ActionResult;

import java.util.ArrayList;

public class ModuleManager {

private static KeyBinding _openGuiKey;
Expand All @@ -24,8 +21,6 @@ public class ModuleManager {


public static void init() {


specialKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.finz.specialKey", InputUtil.Type.MOUSE, 2, "category.finz.config"));
// register gui keybind
_openGuiKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.finz.opengui", InputUtil.Type.KEYSYM, 77, "category.finz.config"));
Expand All @@ -35,15 +30,11 @@ public static void init() {
KeyBindingHelper.registerKeyBinding(module._keybind);


// register events
KeyEvent.KEY_EVENT.register(() -> {
if (_openGuiKey.wasPressed()) {
FinZClient.showConfigScreen();
}
return ActionResult.PASS;
ClientTickEvents.END_CLIENT_TICK.register(mc -> {
EventManager.fire(TickListener.UpdateEvent.INSTANCE);

if (_openGuiKey.wasPressed()) FinZClient.showConfigScreen();
});
ClientTickEvents.END_CLIENT_TICK.register(mc ->
EventManager.fire(TickListener.UpdateEvent.INSTANCE));
WorldRenderEvents.END.register(context ->
EventManager.fire(new WorldRenderListener.RenderEvent(context.matrixStack(), context.tickDelta(), context)));
HudRenderCallback.EVENT.register((c, t) ->
Expand Down
10 changes: 10 additions & 0 deletions src/client/java/dev/symo/finz/modules/Modules.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ public class Modules {

public static Zoom zoom = new Zoom();

// movement
public static AutoSneak autoSneak = new AutoSneak();

// render
public static WhatTheFAmILookingAt wtfaila = new WhatTheFAmILookingAt();
public static MaterialScanner materialScanner = new MaterialScanner();
public static PathTracer pathTracer = new PathTracer();
public static ChromaOutline chromaOutline = new ChromaOutline();

public static NoBlindness noBlindness = new NoBlindness();

// esp
public static PlayerESP playerESP = new PlayerESP();
public static MobEsp mobEsp = new MobEsp();
Expand All @@ -35,12 +40,17 @@ public class Modules {
all.add(knockback);
all.add(zoom);

// movement
all.add(autoSneak);

// render
all.add(wtfaila);
all.add(pathTracer);
all.add(materialScanner);
all.add(chromaOutline);

all.add(noBlindness);

// esp
all.add(playerESP);
all.add(mobEsp);
Expand Down
16 changes: 16 additions & 0 deletions src/client/java/dev/symo/finz/modules/impl/AutoClicker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package dev.symo.finz.modules.impl;

import dev.symo.finz.events.listeners.TickListener;
import dev.symo.finz.modules.AModule;
import dev.symo.finz.util.Category;

public class AutoClicker extends AModule implements TickListener {
public AutoClicker() {
super("Auto Clicker - Not implemented", Category.COMBAT);
}

@Override
public void onTick() {

}
}
31 changes: 31 additions & 0 deletions src/client/java/dev/symo/finz/modules/impl/AutoSneak.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package dev.symo.finz.modules.impl;

import dev.symo.finz.mixininterfaces.IKeyBind;
import dev.symo.finz.modules.AModule;
import dev.symo.finz.util.Category;

public class AutoSneak extends AModule {
private boolean sneaking = false;

public AutoSneak() {
super("Auto Sneak", Category.MOVEMENT);
}

public void sneak(boolean clipping) {
if (!isEnabled() || !mc.player.isOnGround()) {
if (sneaking) setSneaking(false);
return;
}

if (mc.world.isSpaceEmpty(mc.player, mc.player.getBoundingBox().stretch(0, -mc.player.getStepHeight(),0))) clipping = true;

setSneaking(clipping);
}

private void setSneaking(boolean sneak) {
if (sneak) mc.options.sneakKey.setPressed(true);
else ((IKeyBind) mc.options.sneakKey).resetPressedState();

sneaking = sneak;
}
}
10 changes: 10 additions & 0 deletions src/client/java/dev/symo/finz/modules/impl/NoBlindness.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package dev.symo.finz.modules.impl;

import dev.symo.finz.modules.AModule;
import dev.symo.finz.util.Category;

public class NoBlindness extends AModule{
public NoBlindness() {
super("No Blindness", Category.RENDER);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dev.symo.finz.events.listeners.HudRenderListener;
import dev.symo.finz.modules.AModule;
import dev.symo.finz.tracker.BreakProgressTracker;
import dev.symo.finz.mixininterfaces.BreakProgressTracker;
import dev.symo.finz.util.*;
import net.fabricmc.fabric.api.mininglevel.v1.MiningLevelManager;
import net.minecraft.block.Block;
Expand Down
5 changes: 3 additions & 2 deletions src/client/resources/finz.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
"package": "dev.symo.finz.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"client.ZoomMixin"
],
"client": [
"client.ClientPlayerEntityMixin",
"client.ClientPlayerInteractionManagerMixin",
"client.InputEventMixin",
"client.KeyBindingMixin",
"client.SelectedBlockOutLineMixin",
"client.ToolTipMixin",
"client.WorldRendererMixin",
"client.ZoomMixin",
"client.fastplace.FastPlaceClientMixin",
"client.fastplace.FastPlaceInvoker"
],
Expand Down

0 comments on commit 6c2d294

Please sign in to comment.