Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ bin/
# fabric

run/

DEVNODE/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,4 @@ This project is provided **as-is** with **no warranty** of any kind.

> I am **not responsible** for any **bans, data loss, in-game money loss**, or **any other consequences** that may arise from using this addon.
>
> **Use at your own risk.** If you lose items, get banned, or otherwise suffer any kind of issue — I simply don't care. You've been warned. Use an alt.
> **Use at your own risk.** If you lose items, get banned, or otherwise suffer any kind of issue — I simply don't care. You've been warned. Use an alt.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.1
16.2
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ repositories {
implementation("com.google.code.gson:gson:2.10.1")

include(implementation(annotationProcessor("com.github.bawnorton.mixinsquared:mixinsquared-fabric:0.3.7-beta.1")!!)!!)

// MixinExtras for @WrapOperation
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.1")!!)!!)



Expand Down
Empty file modified gradlew
100644 → 100755
Empty file.
15 changes: 15 additions & 0 deletions src/main/java/com/nnpg/glazed/GlazedAddon.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package com.nnpg.glazed;

import com.nnpg.glazed.commands.*;
import com.nnpg.glazed.MyScreen;
import com.nnpg.glazed.modules.esp.*;
import com.nnpg.glazed.modules.main.*;
import com.nnpg.glazed.modules.pvp.*;
import com.nnpg.glazed.protection.ModRegistry;
import com.nnpg.glazed.protection.TranslationProtectionHandler;
import meteordevelopment.meteorclient.addons.MeteorAddon;
import meteordevelopment.meteorclient.commands.Commands;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.Category;
import meteordevelopment.orbit.EventHandler;
import meteordevelopment.meteorclient.events.game.GameJoinedEvent;
import meteordevelopment.meteorclient.events.game.GameLeftEvent;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class GlazedAddon extends MeteorAddon {
private static final Logger LOGGER = LoggerFactory.getLogger("Glazed");

public static final Category CATEGORY = new Category("Glazed", new ItemStack(Items.CAKE));
public static final Category esp = new Category("Glazed ESP ", new ItemStack(Items.VINE));
Expand All @@ -22,6 +30,8 @@ public class GlazedAddon extends MeteorAddon {

@Override
public void onInitialize() {
LOGGER.debug("[Glazed] Initializing protection modules");

Modules.get().add(new SpawnerProtect());
Modules.get().add(new AntiTrap());
Modules.get().add(new CoordSnapper());
Expand Down Expand Up @@ -101,6 +111,8 @@ public void onInitialize() {
Modules.get().add(new PremiumTunnelBaseFinder());
Modules.get().add(new AdminList());
Modules.get().add(new AutoTreeFarmer());

Commands.add(new OrderItemCommand());
}

@EventHandler
Expand All @@ -111,6 +123,9 @@ private void onGameJoined(GameJoinedEvent event) {
@EventHandler
private void onGameLeft(GameLeftEvent event) {
MyScreen.resetSessionCheck();
// Clear protection caches on disconnect
TranslationProtectionHandler.clearCache();
ModRegistry.clearServerPackKeys();
}

@Override
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/nnpg/glazed/MyScreen.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nnpg.glazed;

import com.nnpg.glazed.GlazedAddon;
import meteordevelopment.meteorclient.gui.GuiTheme;
import meteordevelopment.meteorclient.gui.WindowScreen;
import meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList;
Expand Down
76 changes: 76 additions & 0 deletions src/main/java/com/nnpg/glazed/commands/OrderItemCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.nnpg.glazed.commands;

import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.component.type.ItemEnchantmentsComponent;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.command.CommandSource;

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

public class OrderItemCommand extends Command {

public OrderItemCommand() {
super("orderitem", "Runs /order for the item in your main hand with its enchantments.");
}

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
if (mc.player == null) return SINGLE_SUCCESS;

ItemStack mainHandItem = mc.player.getMainHandStack();
if (mainHandItem.isEmpty()) {
error("You are not holding any item in your main hand.");
return SINGLE_SUCCESS;
}

String itemName = getItemName(mainHandItem);
List<String> enchantmentStrings = getEnchantments(mainHandItem);

StringBuilder searchCommand = new StringBuilder("order ");
searchCommand.append(itemName);

if (!enchantmentStrings.isEmpty()) {
searchCommand.append(" ");
searchCommand.append(String.join(" ", enchantmentStrings));
}

String command = searchCommand.toString();
info("Ordering: /" + command);
mc.getNetworkHandler().sendChatCommand(command);
return SINGLE_SUCCESS;
});
}

private String getItemName(ItemStack stack) {
String itemId = stack.getItem().toString();
if (itemId.contains(":")) {
itemId = itemId.split(":")[1];
}
return itemId.toLowerCase().replace(" ", "_");
}

private List<String> getEnchantments(ItemStack stack) {
List<String> result = new ArrayList<>();
ItemEnchantmentsComponent enchantments = EnchantmentHelper.getEnchantments(stack);
for (RegistryEntry<Enchantment> entry : enchantments.getEnchantments()) {
int level = enchantments.getLevel(entry);
String enchantmentName = getEnchantmentName(entry);
result.add(enchantmentName + " " + level);
}
return result;
}

private String getEnchantmentName(RegistryEntry<Enchantment> enchantmentEntry) {
String enchantmentId = enchantmentEntry.getIdAsString();
if (enchantmentId.contains(":")) {
enchantmentId = enchantmentId.split(":")[1];
}
return enchantmentId.toLowerCase().replace(" ", "_");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class MeteorMixinCanceller implements MixinCanceller {

static {
if (METEOR_PRESENT) {
//LOGGER.info("[Glazed] Meteor autoban on donut is active");
LOGGER.info("[Glazed Protection] Meteor Client detected - Meteor's key resolution protection will be disabled to avoid detection.");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.nnpg.glazed.mixin.protection;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.nnpg.glazed.protection.ClientSpoofer;
import com.nnpg.glazed.protection.PacketContext;
import com.nnpg.glazed.protection.TranslationProtectionHandler;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;
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.CallbackInfo;

@Mixin(ClientConnection.class)
public class ClientConnectionMixin {

@WrapOperation(
method = "handlePacket",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/network/packet/Packet;apply(Lnet/minecraft/network/listener/PacketListener;)V")
)
private static <T extends PacketListener> void glazed$wrapApply(
Packet<T> packet,
T listener,
Operation<Void> original) {
PacketContext.setPacketName(packet);
PacketContext.setProcessingPacket(true);
try {
original.call(packet, listener);
} finally {
PacketContext.setProcessingPacket(false);
}
}

@Inject(method = "send(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true)
private void glazed$onSend(Packet<?> packet, CallbackInfo ci) {

if (packet.getClass().getName().contains("CustomPayloadC2SPacket")) {
try {
java.lang.reflect.Method payloadMethod = packet.getClass().getMethod("payload");
Object payload = payloadMethod.invoke(packet);

java.lang.reflect.Method idAccessor = payload.getClass().getMethod("id");
Object idObj = idAccessor.invoke(payload);

Identifier id;
if (idObj instanceof Identifier) {
id = (Identifier) idObj;
} else {
java.lang.reflect.Method idMethod = idObj.getClass().getMethod("id");
id = (Identifier) idMethod.invoke(idObj);
}

if (ClientSpoofer.shouldBlockPayload(id)) {
ci.cancel();
}
} catch (Throwable t) {

}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.nnpg.glazed.mixin.protection;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.nnpg.glazed.protection.PacketContext;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.handler.DecoderHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(DecoderHandler.class)
public class DecoderHandlerMixin {

@WrapOperation(
method = "decode",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/network/codec/PacketCodec;decode(Ljava/lang/Object;)Ljava/lang/Object;")
)
private Object glazed$wrapDecode(PacketCodec<?, ?> instance, Object buffer, Operation<Object> original) {
PacketContext.setProcessingPacket(true);
try {
return original.call(instance, buffer);
} finally {
PacketContext.setProcessingPacket(false);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package com.nnpg.glazed.mixin.protection;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.nnpg.glazed.protection.PacketContext;
import com.nnpg.glazed.protection.TranslationProtectionHandler;
import com.nnpg.glazed.protection.TranslationProtectionHandler.InterceptionType;
import com.nnpg.glazed.protection.KeybindDefaults;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.text.KeybindTextContent;
import net.minecraft.text.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.function.Supplier;

@Mixin(KeybindTextContent.class)
public class KeybindTextContentMixin {
private static final Logger LOGGER = LoggerFactory.getLogger("Glazed-Protection");

@Shadow @Final
private String key;

@Unique
private boolean glazed$fromPacket = false;

@Inject(method = "<init>(Ljava/lang/String;)V", at = @At("TAIL"))
private void glazed$tagFromPacket(String key, CallbackInfo ci) {
this.glazed$fromPacket = PacketContext.isProcessingPacket();
}

@WrapOperation(
method = "getTranslated",
at = @At(value = "INVOKE", target = "Ljava/util/function/Supplier;get()Ljava/lang/Object;"),
require = 0
)
private Object glazed$interceptKeybind(Supplier<?> supplier, Operation<Object> original) {
try {
if (!this.glazed$fromPacket || glazed$isIntegratedServerRunning()) {
return original.call(supplier);
}
} catch (Throwable t) {

return original.call(supplier);
}

if (KeybindDefaults.hasDefault(key)) {
String spoofedValue = KeybindDefaults.getDefault(key);
glazed$logBlocked(key, spoofedValue);
return Text.literal(spoofedValue);
}

glazed$logBlocked(key, key);
return Text.translatable(key);
}

@Unique
private static boolean glazed$isIntegratedServerRunning() {
try {

return net.minecraft.client.MinecraftClient.getInstance().isIntegratedServerRunning();
} catch (Exception e) {
return false;
}
}

@Unique
private void glazed$logBlocked(String keybindName, String spoofedValue) {
String realValue = glazed$readKeybindDisplay();

TranslationProtectionHandler.logDetection(InterceptionType.KEYBIND, keybindName, realValue, spoofedValue);
}

@Unique
private String glazed$readKeybindDisplay() {
try {
Text display = KeyBinding.getLocalizedName(key).get();
if (display != null) {
return display.getString();
}
} catch (Exception e) {
LOGGER.info("[Glazed Protection] Failed to read keybind '{}': {}", key, e.getMessage());
}
return key;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.nnpg.glazed.mixin.protection;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.nnpg.glazed.protection.PacketContext;
import com.nnpg.glazed.protection.TranslationProtectionHandler;
import net.minecraft.network.NetworkThreadUtils;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.util.thread.ThreadExecutor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(NetworkThreadUtils.class)
public class PacketUtilsMixin {

@WrapOperation(
method = "forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/thread/ThreadExecutor;execute(Ljava/lang/Runnable;)V"),
require = 0
)
private static void glazed$wrapForceMainThread(ThreadExecutor<?> engine, Runnable task, Operation<Void> original,
Packet<?> packet, PacketListener listener) {

original.call(engine, (Runnable) () -> {
PacketContext.setPacketName(packet.getClass().getSimpleName());
PacketContext.setProcessingPacket(true);
try {
task.run();
} finally {
PacketContext.setProcessingPacket(false);
}
});
}
}
Loading