MR ROBOT

csinalsz nekem egy minecraft chest esp.jar modot

Kodari AI
KodariNov 6 at 9:02 pm 2
ChestESP
ChestESP is a Fabric mod for Minecraft that highlights nearby chests, barrels, shulker boxes, and other storage containers with a glowing outline through walls. Players can toggle the ESP effect with a configurable keybind, adjust the render distance, and customize the highlight color for different container types. The mod uses a client-side renderer that draws box outlines around detected storage blocks within range, making it easy to locate loot in dungeons, villages, and player bases. It supports both single-player and multiplayer servers, with all settings stored in a JSON configuration file for easy editing.
  1. Fabric 26.3 kliensmodot hozok létre Chest ESP néven.

  2. A HUD a betöltött chunkok ládáit keresi, majd a legközelebbi nyolc koordinátáját és távolságát mutatja.

  3. Hozzáadom a Fabric/Gradle buildfájlokat, így a projekt jar-ként fordítható.

Elkészült a Fabric 26.3 kliensmod: a HUD a betöltött területen 64 blokkon belül megkeresi a normál és csapdaládákat, majd kiírja a legközelebbi 8 koordinátáját és távolságát. Ez koordinátás HUD ESP, nem 3D-s ládakörvonal.

A jar letöltéséhez Kodariban kattints Compile → Compile, majd a sikeres buildnél Download.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
5 186
src/client/java/com/kodari/chestesp/ChestEspClient.java
package com.kodari.chestesp;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.DeltaTracker;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.Identifier;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.status.ChunkStatus;
import net.minecraft.world.phys.Vec3;

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

public class ChestEspClient implements ClientModInitializer {
	private static final int SEARCH_RADIUS = 64;
	private static final int MAX_DISPLAYED_CHESTS = 8;
	private static final long SCAN_INTERVAL_NANOS = 500_000_000L;
	private static final int TEXT_COLOR = 0xFFFFAA00;
	private static final int SHADOW_COLOR = 0xFFFFFFFF;

	private static ClientLevel cachedLevel;
	private static long lastScanNanos;
	private static List<ChestMarker> cachedChests = List.of();

	@Override
	public void onInitializeClient() {
		HudElementRegistry.addLast(
				Identifier.fromNamespaceAndPath("chestesp", "chest_list"),
				ChestEspClient::renderHud
		);
	}

	private static void renderHud(GuiGraphicsExtractor graphics, DeltaTracker deltaTracker) {
		Minecraft minecraft = Minecraft.getInstance();
		ClientLevel level = minecraft.level;
		var player = minecraft.player;
		if (level == null || player == null) {
			cachedLevel = level;
			cachedChests = List.of();
			return;
		}

		long now = System.nanoTime();
		if (level != cachedLevel || now - lastScanNanos >= SCAN_INTERVAL_NANOS) {
			refreshChests(level, player.position());
			cachedLevel = level;
			lastScanNanos = now;
		}

		graphics.text(minecraft.font, "Láda ESP · " + SEARCH_RADIUS + " blokk", 8, 8, TEXT_COLOR, true);
		if (cachedChests.isEmpty()) {
			graphics.text(minecraft.font, "Nincs láda a betöltött chunkokban.", 8, 20, SHADOW_COLOR, true);
			return;
		}

		int displayed = Math.min(cachedChests.size(), MAX_DISPLAYED_CHESTS);
		for (int i = 0; i < displayed; i++) {
			ChestMarker chest = cachedChests.get(i);
			int distance = (int) Math.round(Math.sqrt(chest.distanceSquared()));
			String label = "Láda %d %d %d  ·  %d blokk".formatted(chest.x(), chest.y(), chest.z(), distance);
			graphics.text(minecraft.font, label, 8, 20 + i * 12, SHADOW_COLOR, true);
		}
	}

	private static void refreshChests(ClientLevel level, Vec3 playerPosition) {
		int playerBlockX = (int) Math.floor(playerPosition.x);
		int playerBlockZ = (int) Math.floor(playerPosition.z);
		int centerChunkX = Math.floorDiv(playerBlockX, 16);
		int centerChunkZ = Math.floorDiv(playerBlockZ, 16);
		int chunkRadius = (SEARCH_RADIUS + 15) / 16;
		double maxDistanceSquared = (double) SEARCH_RADIUS * SEARCH_RADIUS;
		List<ChestMarker> found = new ArrayList<>();

		for (int chunkX = centerChunkX - chunkRadius; chunkX <= centerChunkX + chunkRadius; chunkX++) {
			for (int chunkZ = centerChunkZ - chunkRadius; chunkZ <= centerChunkZ + chunkRadius; chunkZ++) {
				LevelChunk chunk = level.getChunkSource().getChunk(chunkX, chunkZ, ChunkStatus.FULL, false);
				if (chunk == null) {
					continue;
				}

				for (BlockEntity blockEntity : chunk.getBlockEntities().values()) {
					if (!(blockEntity instanceof ChestBlockEntity)) {
						continue;
					}

					BlockPos pos = blockEntity.getBlockPos();
					double dx = pos.getX() + 0.5 - playerPosition.x;
					double dy = pos.getY() + 0.5 - playerPosition.y;
					double dz = pos.getZ() + 0.5 - playerPosition.z;
					double distanceSquared = dx * dx + dy * dy + dz * dz;
					if (distanceSquared <= maxDistanceSquared) {
						found.add(new ChestMarker(pos.getX(), pos.getY(), pos.getZ(), distanceSquared));
					}
				}
			}
		}

		found.sort(Comparator.comparingDouble(ChestMarker::distanceSquared));
		cachedChests = List.copyOf(found);
	}

	private record ChestMarker(int x, int y, int z, double distanceSquared) {
	}
}