Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
NoRender no cordinates in F3
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekiplay committed Apr 2, 2024
1 parent a773b14 commit 5d224fd
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package nekiplay.meteorplus.events.hud;

import meteordevelopment.meteorclient.events.Cancellable;

import java.util.ArrayList;
import java.util.List;

public class DebugDrawTextEvent extends Cancellable {

private static final DebugDrawTextEvent INSTANCE = new DebugDrawTextEvent();
private List<String> lines = new ArrayList<String>();

public List<String> getLines() { return lines; }
private boolean isLeft = false;
public boolean isLeft() { return isLeft; }


public static DebugDrawTextEvent get(List<String> lines, boolean isLeft) {
INSTANCE.lines = lines;
INSTANCE.isLeft = isLeft;
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package nekiplay.meteorplus.mixin.meteorclient.modules;

import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.meteorclient.systems.modules.Module;
import meteordevelopment.meteorclient.systems.modules.render.NoRender;
import meteordevelopment.orbit.EventHandler;
import nekiplay.meteorplus.events.hud.DebugDrawTextEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import java.util.List;

@Mixin(value = NoRender.class, remap = false, priority = 1001)
public class NoRenderMixin extends Module {
public NoRenderMixin(Category category, String name, String description) {
super(category, name, description);
}

@Unique
private final NoRender noRender = (NoRender)(Object) this;
@Unique
private final SettingGroup noRenderMeteorPlusSetting = noRender.settings.createGroup("F3");


@Unique
private final Setting<Boolean> noPosition = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-position")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> noPositionBlock = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-position-block")
.defaultValue(false)
.build()
);
@Unique
private final Setting<Boolean> noPositionChunk = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-position-chunk")
.defaultValue(false)
.build()
);

@Unique
private final Setting<Boolean> noTargetBlockPosition = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-target-block-position")
.defaultValue(false)
.build()
);

@Unique
private final Setting<Boolean> noTargetFluidPosition = noRenderMeteorPlusSetting.add(new BoolSetting.Builder()
.name("remove-target-fluid-position")
.defaultValue(false)
.build()
);

@Unique
@EventHandler
private void onDebugF3RenderText(DebugDrawTextEvent event) {
List<String> lines = event.getLines();

if (event.isLeft()) {
if (noPosition.get()) {
lines.removeIf(s -> s.contains("XYZ:"));
}

if (noPositionBlock.get()) {
lines.removeIf(s -> s.contains("Block:"));
}

if (noPositionChunk.get()) {
lines.removeIf(s -> s.contains("Chunk:"));
}
} else {
if (noTargetBlockPosition.get()) {
lines.removeIf(s -> s.contains("Targeted Block:"));
}

if (noTargetFluidPosition.get()) {
lines.removeIf(s -> s.contains("Targeted Fluid:"));
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package nekiplay.meteorplus.mixin.minecraft.hud;

import meteordevelopment.meteorclient.MeteorClient;
import nekiplay.meteorplus.events.hud.DebugDrawTextEvent;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.hud.DebugHud;
import org.spongepowered.asm.mixin.Final;
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.LocalCapture;

import java.util.List;

@Mixin(value = DebugHud.class, priority = 1001)
public class DebugHudMixin {
@Shadow
@Final
private MinecraftClient client;

@Inject(
method = "drawLeftText",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/DebugHud;drawText(Lnet/minecraft/client/gui/DrawContext;Ljava/util/List;Z)V",
shift = At.Shift.BEFORE
),
locals = LocalCapture.CAPTURE_FAILHARD
)
private void modifyDrawLeftText(DrawContext ignored, CallbackInfo ci, List<String> lines) {
DebugDrawTextEvent debugDrawTextEvent = DebugDrawTextEvent.get(lines, true);
MeteorClient.EVENT_BUS.post(debugDrawTextEvent);
}

@Inject(
method = "drawRightText",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/DebugHud;drawText(Lnet/minecraft/client/gui/DrawContext;Ljava/util/List;Z)V",
shift = At.Shift.BEFORE
),
locals = LocalCapture.CAPTURE_FAILHARD
)
private void modifyDrawRightText(DrawContext ignored, CallbackInfo ci, List<String> lines) {
DebugDrawTextEvent debugDrawTextEvent = DebugDrawTextEvent.get(lines, false);
MeteorClient.EVENT_BUS.post(debugDrawTextEvent);
}
}
6 changes: 6 additions & 0 deletions src/main/java/nekiplay/meteorplus/mixinclasses/SpoofMode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package nekiplay.meteorplus.mixinclasses;

public enum SpoofMode {
Remove,
Fake,
}
6 changes: 4 additions & 2 deletions src/main/resources/meteorplus.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@
"meteorclient.ModulesScreenMixin",
"meteorclient.WMeteorModuleMixin",
"meteorclient.WPressableMixin",
"meteorclient.modules.NoRenderMixin",
"meteorclient.modules.AutoToolMixin",
"meteorclient.modules.BlockESPMixin",
"meteorclient.modules.ESPMixin",
"meteorclient.modules.FreecamMixin",
"meteorclient.modules.ItemHighlightMixin",
"meteorclient.modules.KillAuraMixin",
"meteorclient.modules.TracersMixin",
"meteorclient.modules.WaypointsModuleMixin",
"meteorclient.modules.BlockESPMixin",
"minecraft.ClientConnectionAccessor",
"minecraft.ClientPlayerInteractionManagerMixin",
"minecraft.CraftingScreenHandlerAccessor",
"minecraft.MinecraftClientMixin",
"minecraft.ShapelessRecipeAccessor"
"minecraft.ShapelessRecipeAccessor",
"minecraft.hud.DebugHudMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 5d224fd

Please sign in to comment.