Create a module named Chunk Finder under the Visuals category. The module should scan the surrounding area for amethyst geodes and other structures or environmental features that may indicate player activity.
Include customizable settings for scan sensitivity and simulation distance, allowing users to adjust how thoroughly the area is scanned and how far the module searches. Ensure the module integrates seamlessly with the existing interface, follows the current visual design, and remains fully compatible with the current version of the project.
Implement the module with clean, efficient, and well-organized code, ensuring that all settings function correctly and that the module behaves consistently with the existing modules. Make it a mod (.jar) for 1.21.11 fabric.
Make the gui look like the image i attached please.
--- 📎 Attached 1 file(s):
File: pasted-code-1792883225238.txt
package com.donut.client.modules.visual;
import com.donut.client.module.Category;
import com.donut.client.module.Module;
import com.donut.client.setting.BooleanSetting;
import com.donut.client.setting.SliderSetting;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.chunk.WorldChunk;
import net.minecraft.block.Blocks;
import net.minecraft.block.BlockState;
import java.awt.Color;
import java.util.concurrent.ConcurrentHashMap;
public class ChunkFinderModule extends Module {
// Customizable Settings
private final SliderSetting scanSensitivity = settings.add(new SliderSetting("Scan Sensitivity", 1.0, 5.0, 10.0, 1));
private final SliderSetting simulationDistance = settings.add(new SliderSetting("Simulation Distance", 4.0, 12.0, 32.0, 1));
private final BooleanSetting detectGeodes = settings.add(new BooleanSetting("Detect Geodes", true));
private final BooleanSetting detectActivity = settings.add(new BooleanSetting("Player Activity", true));
// Cache to store discovered chunks and their classification
private final ConcurrentHashMap<ChunkPos, ChunkType> discoveredChunks = new ConcurrentHashMap<>();
public enum ChunkType {
GEODE(new Color(138, 43, 226, 180)), // Purple highlight
ACTIVITY(new Color(255, 69, 0, 180)); // Orange/Red highlight
private final Color color;
ChunkType(Color color) { this.color = color; }
public Color getColor() { return color; }
}
public ChunkFinderModule() {
super("Chunk Finder", "Scan surrounding chunks for geodes and player activity", Category.VISUAL);
}
@Override
public void onEnable() {
discoveredChunks.clear();
}
@Override
public void onTick() {
if (mc.world == null || mc.player == null) return;
int radius = (int) simulationDistance.getValue();
ChunkPos playerChunk = mc.player.getChunkPos();
int sensitivityInterval = Math.max(1, (int) (11 - scanSensitivity.getValue()));
// Scan chunks within the simulation distance radius
for (int x = -radius; x <= radius; x++) {
for (int z = -radius; z <= radius; z++) {
int chunkX = playerChunk.x + x;
int chunkZ = playerChunk.z + z;
ChunkPos pos = new ChunkPos(chunkX, chunkZ);
if (mc.world.isChunkLoaded(chunkX, chunkZ) && !discoveredChunks.containsKey(pos)) {
if ((Math.abs(chunkX + chunkZ) % sensitivityInterval) == 0) {
WorldChunk chunk = mc.world.getChunk(chunkX, chunkZ);
analyzeChunk(chunk, pos);
}
}
}
}
}
private void analyzeChunk(WorldChunk chunk, ChunkPos pos) {
// Check block entities and blocks for geodes or player activity
boolean hasGeode = false;
boolean hasActivity = false;
// Efficient scan across vertical height bounds
for (int y = mc.world.getBottomY(); y < mc.world.getTopY(); y += 16) {
BlockState state = chunk.getBlockState(pos.getStartPos().withY(y));
// Detect Amethyst components (Budding Amethyst / Calcite indicator)
if (detectGeodes.getValue() && (state.isOf(Blocks.BUDDING_AMETHYST) || state.isOf(Blocks.CALCITE))) {
hasGeode = true;
}
// Detect potential player activity (placed storage, chests, or non-natural blocks)
if (detectActivity.getValue() && (state.isOf(Blocks.CHEST) || state.isOf(Blocks.BARREL) || state.isOf(Blocks.CRAFTING_TABLE))) {
hasActivity = true;
}
}
if (hasGeode) {
discoveredChunks.put(pos, ChunkType.GEODE);
} else if (hasActivity) {
discoveredChunks.put(pos, ChunkType.ACTIVITY);
}
}
@Override
public void onRender3D(MatrixStack matrices, float tickDelta) {
if (mc.world == null || discoveredChunks.isEmpty()) return;
// Render outlines/boxes for discovered chunks in 3D world space
for (var entry : discoveredChunks.entrySet()) {
ChunkPos pos = entry.getKey();
ChunkType type = entry.getValue();
// Render logic interfacing with your client's existing Render3D utilities
renderChunkBox(matrices, pos, type.getColor());
}
}
private void renderChunkBox(MatrixStack matrices, ChunkPos pos, Color color) {
// Coordinates and box rendering implementation matching StorageFinder / Base Finder
int minX = pos.getStartX();
int minZ = pos.getStartZ();
int maxX = pos.getEndX();
int maxZ = pos.getEndZ();
int minY = mc.world.getBottomY();
int maxY = mc.world.getTopY();
// Call your client's built-in box outline renderer here
// e.g., RenderUtils.drawBox(matrices, minX, minY, minZ, maxX, maxY, maxZ, color);
}
}
[Viewing 1 image]