Zac Grogan

hey kodari, can you create a pin mod that allows players to press a keybind ( prefferably [ ) when done so, you will zoom into 30 fov as long as your holding that key, releasing will bring yoour fov back to how it was. when zoomed, add a small gui thats 5 by 1 thats under your crosshair by halfway from crosshair to bottom of screen. this gui will appear like hotbar with glass panes coloured red orange yellow green blue and purple to reprezent pins. this will only appear when zoomed. pressing ] when zoomed will place a pin at wherever your looking ( only if there are rendered chunks in that area. the pin will always be in sight even if where its placed is not rendered. the pin will be a beacon beam going up about half your screen but skinny, (the width of a block from a few blocks away ( not very big ) below the pin, there will be a set of coordinates displaying how far away you are. if you place a pin, one of the pins in the bar will remove, (left to right) the pin colour will decide on the next pane colour. the pins will stay in the same world/server even if you place them and disconnedt then rejoin. they will not transfer accross servers. you can delete a pin by looking at the pin with [ and clicking the ] button (same as place pin.) because you cannot place a pin on top of a pin, the pin will be deleted instead. the pin will also be deleted if you stand on the block set. when going into your inventory, the small pane gui will not appear and has no way to select it. this makes it so you cannot take the items out in a server or a world. the pins will be visable through walls aswell. whatever else needs doing, you add the rest but i want it to be like legend of zelda (somewhere like links spyglass and pin viewing) you can view pins when not zoomed btw. 26.3 fabric java

Kodari AI
KodariOct 20 at 8:53 am 5
PinSpyglass
Adds a spyglass-style pin system. Pressing [ zooms to 30 FOV while held, showing a 5x1 hotbar-style GUI under the crosshair with colored glass panes (red, orange, yellow, green, blue, purple). Pressing ] while zoomed places a pin at the crosshair target in rendered chunks, creating a visible beacon beam through walls with a distance readout. Pins persist per-world/server, are viewable when not zoomed, and are deleted by looking at one and pressing ] or standing on its block. The GUI is hidden in inventory to prevent item theft.
  1. Scaffold a client-only Fabric 26.3 mod.

  2. Add hold-to-zoom, pin placement/removal, five-pin cycling, and per-server/world persistence.

  3. Render the zoom-only pin bar and through-wall pin markers with distance labels.

Created the client-side Fabric 26.3 pin mod.

  • Hold [ to zoom to 30 FOV; releasing restores your previous FOV.

  • While zoomed, press ] to place a pin on the block you’re looking at, or remove a pin by targeting its block. Pins show through walls with a colored beam and coordinate/distance label, and disappear if you stand on their block.

  • The zoom-only, non-interactive HUD bar has five slots. Pin colors cycle through six colors; adding a sixth pin removes the oldest.

  • Pins are saved locally per server address or single-player save, and separately per dimension. No inventory items are involved.

Zac Grogan

is it created

Kodari AI
KodariOct 20 at 9:38 am 1

Yes — the pin mod has been created in the project. I haven’t confirmed a successful build yet.

Zac Grogan

the pin placing doesnt work sorry. i think its because of the [ and ] at the same time. i dont know what to do please make it work

Kodari AI
KodariOct 20 at 9:53 am 2
  1. Keep [ and ] as the default zoom and pin keys.

  2. Make a pin press register from either the queued click or the key’s press edge, while preventing repeat placements from holding ].

  3. Keep the key state updated each tick to avoid stale presses.

Fixed pin input detection so ] can register through either the queued key press or its press edge, without placing repeatedly if you hold it.

Hold [ to zoom, aim at a solid block, then tap ] while still holding [. You don’t need to press both keys at the exact same moment.

Zac Grogan

ok, the pins are not displaying at all and its not set only if you are standing on the block, its whatever block your looking at aslong as its in render. also there shouldnt be purple pin and when one pin gets used, the colour goes grey unlessremoved and it comes back

Kodari AI
KodariOct 20 at 10:17 am 3

Updated the pin behavior:

  • ] now uses the key’s queued press, so holding it won’t place pins repeatedly.

  • Pins are placed on the block you’re aiming at in a loaded chunk. They no longer disappear just because you’re standing on top of that block.

  • The bar now has five colors—red, orange, yellow, green, and blue. A color turns gray while its pin is active and returns when that pin is removed. Placing a sixth pin won’t replace an existing one.

  • Made the through-wall pin marker larger and brighter.

Zac Grogan

the pins arnet appearing in my pov. make it work please, im wasting credits at this point

Kodari AI
KodariOct 20 at 10:24 am 1
  1. Trace the current marker rendering and identify why it isn’t visible.

  2. Correct the renderer using the exact 26.3 client/Fabric APIs, then leave the existing pin behavior intact.

[Generation stopped]

Zac Grogan

oh, also make the pins appear in my pov because they cant and i can be however far from the block to set the pin. as long as its in my view, i dont have to select the block cause that gives me like a 3 block range

Kodari AI
KodariOct 20 at 10:40 am 2
  1. Trace why pin markers aren’t visible and how placement chooses a target.

  2. Fix markers to render in your POV through walls, and let ] pin the point you’re aiming at even beyond normal block reach.

Fixed the pin POV rendering and placement. Pins now render as screen-space beacons with coordinate and distance labels, so they stay visible through walls and while you’re not zoomed. Press ] while zoomed to pin the block under your aim at long range, up to the loaded render distance; unloaded chunks are skipped.

Zac Grogan

the pin is now visable but 1, please outline the block to see the exact location to pick ut up (like litematica) 2, the pin line from the square is not strait, it comes out of the square more to the left. 3, there is a funny thingy at the top. please remove that

Kodari AI
KodariOct 20 at 10:49 am 1
  1. Fix the pin marker’s beam alignment and remove the stray top graphic.

  2. Add a visible outline around the pinned block to make its exact location clear.

Added a colored outline around each pinned block, centered the beacon line on its marker, and removed the stray cap at the top. The outline is projected into your view, so it remains visible through walls.

Zac Grogan

make the block outline only visble from 3 blocks away

Kodari AI
KodariOct 20 at 10:54 am 1
  1. Limit the block outline to pins within 3 blocks of the player.

  2. Leave the pin beam, label, and visibility unchanged.

The block outline now appears only when you’re within 3 blocks of the pin. The pin marker and distance label remain visible at any distance.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
6 516
src/client/java/com/kodari/pinmod/client/PinModClient.java
package com.kodari.pinmod.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.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.KeyMapping;
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.ClipContext;
import net.minecraft.world.level.storage.LevelResource;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HexFormat;
import java.util.List;
import java.util.Locale;

public final class PinModClient implements ClientModInitializer {

    private static final int MAX_PINS = 5;
    private static final int ZOOM_FOV = 30;
    private static final int[] PIN_COLORS = {
            0xD9E64B4B,
            0xD9F39A3C,
            0xD9F1D64B,
            0xD951C978,
            0xD94C9FEB
    };
    private static final Identifier KEY_CATEGORY_ID = Identifier.fromNamespaceAndPath("pinmod", "controls");
    private static final KeyMapping.Category KEY_CATEGORY = KeyMapping.Category.register(KEY_CATEGORY_ID);
    private static final Identifier HUD_ID = Identifier.fromNamespaceAndPath("pinmod", "pin_bar");

    private static final List<Pin> PINS = new ArrayList<>();
    private static KeyMapping zoomKey;
    private static KeyMapping pinKey;
    private static String activeStoreIdentity;
    private static int originalFov;
    private static boolean zooming;

    @Override
    public void onInitializeClient() {
        zoomKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
                "key.pinmod.zoom",
                InputConstants.KEY_LBRACKET,
                KEY_CATEGORY
        ));
        pinKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
                "key.pinmod.place",
                InputConstants.KEY_RBRACKET,
                KEY_CATEGORY
        ));

        ClientTickEvents.END_CLIENT_TICK.register(PinModClient::onClientTick);
        HudElementRegistry.addLast(HUD_ID, PinModClient::renderPinBar);
    }

    private static void onClientTick(Minecraft client) {
        updateStore(client);

        if (client.player != null && client.level != null && !PINS.isEmpty()) {
            BlockPos playerBlock = client.player.blockPosition();
            if (PINS.removeIf(pin -> pin.position().equals(playerBlock))) {
                savePins();
            }
        }

        boolean pinPressed = pinKey.consumeClick();

        boolean shouldZoom = client.player != null
                && client.level != null
                && client.gui.screen() == null
                && zoomKey.isDown();

        if (shouldZoom && !zooming) {
            originalFov = client.options.fov().get();
            zooming = true;
        }

        if (zooming) {
            if (shouldZoom) {
                if (client.options.fov().get() != ZOOM_FOV) {
                    client.options.fov().set(ZOOM_FOV);
                }
            } else {
                client.options.fov().set(originalFov);
                zooming = false;
            }
        }

        if (shouldZoom && pinPressed && activeStoreIdentity != null) {
            placeOrRemovePin(client);
        }
    }

    private static void updateStore(Minecraft client) {
        String identity = getStoreIdentity(client);
        if (identity == null ? activeStoreIdentity == null : identity.equals(activeStoreIdentity)) {
            return;
        }

        savePins();
        activeStoreIdentity = identity;
        PINS.clear();
        if (identity != null) {
            loadPins();
        }
    }

    private static String getStoreIdentity(Minecraft client) {
        ClientLevel level = client.level;
        if (level == null) {
            return null;
        }

        String worldIdentity;
        if (client.isLocalServer()) {
            var server = client.getSingleplayerServer();
            if (server == null) {
                return null;
            }
            worldIdentity = "local:" + server.getWorldPath(LevelResource.ROOT).toAbsolutePath().normalize();
        } else {
            var server = client.getCurrentServer();
            if (server == null || server.ip == null || server.ip.isBlank()) {
                return null;
            }
            worldIdentity = "server:" + server.ip.toLowerCase(Locale.ROOT);
        }

        return worldIdentity + "|" + level.dimension().identifier();
    }

    private static void placeOrRemovePin(Minecraft client) {
        Vec3 eye = client.player.getEyePosition();
        Vec3 view = client.player.getViewVector(1.0f).normalize();
        double maxDistance = client.options.getEffectiveRenderDistance() * 16.0;

        for (double distance = 0.5; distance <= maxDistance; distance += 0.5) {
            Vec3 sample = eye.add(view.scale(distance));
            BlockPos samplePosition = new BlockPos(
                    (int) Math.floor(sample.x),
                    (int) Math.floor(sample.y),
                    (int) Math.floor(sample.z)
            );
            if (!client.level.isLoaded(samplePosition)) {
                maxDistance = distance - 0.5;
                break;
            }
        }

        if (maxDistance < 0.5) {
            return;
        }

        BlockHitResult blockHit = client.level.clip(new ClipContext(
                eye,
                eye.add(view.scale(maxDistance)),
                ClipContext.Block.OUTLINE,
                ClipContext.Fluid.NONE,
                client.player
        ));
        if (blockHit.getType() != HitResult.Type.BLOCK) {
            return;
        }

        BlockPos position = blockHit.getBlockPos();
        if (client.level.getChunkSource().getChunk(position.getX() >> 4, position.getZ() >> 4, false) == null) {
            return;
        }

        for (int i = 0; i < PINS.size(); i++) {
            if (PINS.get(i).position().equals(position)) {
                PINS.remove(i);
                savePins();
                return;
            }
        }

        if (PINS.size() >= MAX_PINS) {
            return;
        }
        int colorIndex = nextAvailableColorIndex();
        if (colorIndex < 0) {
            return;
        }
        PINS.add(new Pin(position, colorIndex));
        savePins();