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/

/temp
Empty file modified gradlew
100644 → 100755
Empty file.
3 changes: 3 additions & 0 deletions src/main/java/com/nnpg/glazed/GlazedAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public void onInitialize() {
Modules.get().add(new PremiumTunnelBaseFinder());
Modules.get().add(new AdminList());
Modules.get().add(new AutoTreeFarmer());
Modules.get().add(new LayerLock());
Modules.get().add(new ItemESP());
Modules.get().add(new FastXP());
}

@EventHandler
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.nnpg.glazed.mixins;

import com.nnpg.glazed.modules.main.LayerLock;
import meteordevelopment.meteorclient.systems.modules.Modules;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.text.Text;
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(ClientPlayerInteractionManager.class)
public class MixinClientPlayerInteractionManager {

@Inject(method = "interactBlock", at = @At("HEAD"), cancellable = true)
private void onInteractBlock(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
LayerLock module = Modules.get().get(LayerLock.class);

if (module == null || !module.isActive() || !module.isLocked()) return;

ItemStack stack = player.getStackInHand(hand);

if (!(stack.getItem() instanceof BlockItem blockItem)) return;

BlockPos placedPos = hitResult.getBlockPos().offset(hitResult.getSide());
int placementY = placedPos.getY();

boolean blocked = false;
String reason = "";

// 1. Y-Level Check (Unterstützt jetzt Bereiche!)
if (placementY < module.getLockedYStart() || placementY > module.getLockedYEnd()) {
blocked = true;
reason = String.format("Wrong Y=%d (Range: %d-%d)", placementY, module.getLockedYStart(), module.getLockedYEnd());
}
// 2. Block Filter Check (Nur wenn Advanced Settings an sind)
else if (!module.isBlockAllowed(blockItem)) {
blocked = true;
reason = "Block not allowed (" + blockItem.getName().getString() + ")";
}

if (blocked) {
if (module.showNotifications()) {
player.sendMessage(Text.literal("§c[LayerLock] Blocked §7— " + reason), true);
}
cir.setReturnValue(ActionResult.FAIL);
}
}
}
Loading