This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
generated from MeteorDevelopment/meteor-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
172 additions
and
2 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/main/java/nekiplay/meteorplus/events/hud/DebugDrawTextEvent.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,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; | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
src/main/java/nekiplay/meteorplus/mixin/meteorclient/modules/NoRenderMixin.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,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:")); | ||
} | ||
} | ||
|
||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/nekiplay/meteorplus/mixin/minecraft/hud/DebugHudMixin.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,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
6
src/main/java/nekiplay/meteorplus/mixinclasses/SpoofMode.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,6 @@ | ||
package nekiplay.meteorplus.mixinclasses; | ||
|
||
public enum SpoofMode { | ||
Remove, | ||
Fake, | ||
} |
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