A

Can you make a mod i can download that gives coordinates of the nearest netherite block for fabric 26.3 java minecraft and it works on donut smp

Kodari AI
KodariOct 31 at 2:53 pm 1
NetheriteLocator
A Fabric mod for Minecraft Java 26.3 that displays the coordinates of the nearest netherite block to the player. Features a client-side HUD overlay showing distance and XYZ coordinates, a toggleable keybind to activate/deactivate the locator, and a configurable scan radius. Uses efficient chunk scanning to locate ancient debris blocks in the Nether, updating the display in real-time as the player moves. Compatible with multiplayer servers like Donut SMP, requiring no server-side installation.
  1. Build a Fabric 26.3 client mod with a keybind that searches only chunks currently available to your client.

  2. Report the nearest loaded netherite block’s coordinates and distance in chat; it won’t reveal unloaded blocks or bypass Donut SMP protections.

  3. Add the Gradle/Fabric metadata and client entrypoint. I’ll verify the 26.3 APIs before writing the files.

Created Netherite Finder for Fabric 26.3. Press N to scan nearby chunks currently loaded by your client; the nearest block’s coordinates and distance appear in chat.

It can’t find blocks in unloaded chunks or bypass Donut SMP’s server protections, so I can’t guarantee it will find blocks the server doesn’t send to your client.

To download it: click Compile in the top bar (on phone: ⋮ → Compile Project), click Compile in the window, then click Download when the build succeeds.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
6 187
src/client/java/com/kodari/netheritefinder/client/NetheriteFinderClient.java
package com.kodari.netheritefinder.client;

import com.mojang.blaze3d.platform.InputConstants;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.status.ChunkStatus;

public class NetheriteFinderClient implements ClientModInitializer {
    private static final KeyMapping SCAN_KEY = KeyMappingHelper.registerKeyMapping(
            new KeyMapping("key.netheritefinder.scan", InputConstants.KEY_N, KeyMapping.Category.MISC)
    );

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            if (SCAN_KEY.consumeClick()) {
                scanLoadedChunks(client);
            }
        });
    }

    private static void scanLoadedChunks(Minecraft client) {
        if (client.level == null || client.player == null) {
            return;
        }

        double playerX = client.player.getX();
        double playerY = client.player.getY();
        double playerZ = client.player.getZ();
        int centerChunkX = ((int) Math.floor(playerX)) >> 4;
        int centerChunkZ = ((int) Math.floor(playerZ)) >> 4;
        int searchRadius = client.options.renderDistance().get() + 1;

        double nearestDistanceSquared = Double.POSITIVE_INFINITY;
        int nearestX = 0;
        int nearestY = 0;
        int nearestZ = 0;
        boolean found = false;

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

                LevelChunkSection[] sections = chunk.getSections();
                for (int sectionIndex = 0; sectionIndex < sections.length; sectionIndex++) {
                    LevelChunkSection section = sections[sectionIndex];
                    if (!section.maybeHas(state -> state.getBlock() == Blocks.NETHERITE_BLOCK)) {
                        continue;
                    }

                    int baseX = chunkX << 4;
                    int baseY = chunk.getSectionYFromSectionIndex(sectionIndex) << 4;
                    int baseZ = chunkZ << 4;

                    for (int localY = 0; localY < 16; localY++) {
                        for (int localX = 0; localX < 16; localX++) {
                            for (int localZ = 0; localZ < 16; localZ++) {
                                if (section.getBlockState(localX, localY, localZ).getBlock() != Blocks.NETHERITE_BLOCK) {
                                    continue;
                                }

                                int blockX = baseX + localX;
                                int blockY = baseY + localY;
                                int blockZ = baseZ + localZ;
                                double dx = blockX + 0.5 - playerX;
                                double dy = blockY + 0.5 - playerY;
                                double dz = blockZ + 0.5 - playerZ;
                                double distanceSquared = dx * dx + dy * dy + dz * dz;

                                if (distanceSquared < nearestDistanceSquared) {
                                    nearestDistanceSquared = distanceSquared;
                                    nearestX = blockX;
                                    nearestY = blockY;
                                    nearestZ = blockZ;
                                    found = true;
                                }
                            }
                        }
                    }
                }
            }
        }

        if (found) {
            double distance = Math.sqrt(nearestDistanceSquared);
            client.gui.hud.getChat().addClientSystemMessage(Component.literal(String.format(
                    "Nearest loaded netherite block: %d, %d, %d (%.1f blocks away)",
                    nearestX,
                    nearestY,
                    nearestZ,
                    distance
            )));
        } else {
            client.gui.hud.getChat().addClientSystemMessage(Component.literal(
                    "No netherite blocks found in currently loaded chunks."
            ));
        }
    }
}