Jerricks

make a mod that shows what degree im looking at interm of how high im looking with 0 being the ground and directly up being 180 for 1.21.11

Kodari AI
KodariNov 8 at 1:06 pm 2
LookAngleDisplay
A Minecraft Fabric mod for version 1.21.11 that displays the player's vertical look angle on the HUD. Shows the pitch angle in degrees where 0 represents looking directly at the ground and 180 represents looking directly up. The mod continuously updates the displayed angle in real-time as the player moves their camera, providing precise numerical feedback for building, aiming, or any activity requiring exact vertical alignment. Includes a simple toggle keybind to show or hide the angle display.
  1. Create a Fabric 1.21.11 client HUD mod that displays the vertical look angle from 0° at the horizon to 180° straight up.

Created Look Angle for Fabric 1.21.11. Its HUD shows Look: N° in the upper-left: 0° looking straight down, 90° level, and 180° straight up.

Jerricks

put it right under my crosshair and also make it so if im holding a pearl and begin to look up my screen locks between 125-145 degrees then after i throw the pearl and begin to look down my screen locks 3-5 degrees below whatever degree i threw the pearl for 0.5 seconds or until i throw a windcharge

Kodari AI
KodariNov 8 at 1:45 pm 2
  1. Move the angle readout beneath the crosshair.

  2. Add the requested pearl aiming and post-throw pitch lock, released by the timer or a wind charge.

  1. The aim assist will hold a randomly selected angle from 125°–145° while you look up with a pearl, then snap 3°–5° below the throw angle when you look down. That follow-up lock lasts 10 ticks (0.5 seconds) and is canceled by throwing a wind charge.

  • Moved the angle display to the center, directly below the crosshair.

  • With a pearl in hand, looking up now locks the view at a randomly selected angle from 125°–145°.

  • After a pearl is thrown, beginning to look down locks the view 3°–5° below the throw angle for 0.5 seconds. Throwing a wind charge cancels that follow-up lock.

Jerricks

it doesnt let me join my world or servers with the mod on it says network protcolm error fix it

Kodari AI
KodariNov 8 at 2:05 pm 1
  • Remove the item-use mixin that hooks pearl/wind-charge packets; keep the angle HUD and remove the aim-lock feature so it cannot interfere with joining.

Removed the pearl/wind-charge interaction mixin to avoid interfering with joining. The angle HUD remains, but the pearl and wind-charge aim locks are disabled. If the network protocol error still appears, send the exact disconnect message; this mod doesn’t add custom network packets.

Jerricks

dont lock onto the thing just make my mouse stop working to move when i reach the angle then after i throw the pearl my mouse works back until i move 3-6 degrees below the degree where i threw the pearl then my mouse freezes again for 0.5 seconds or until i throw a windcharge

Kodari AI
KodariNov 8 at 2:22 pm 2
  1. Replace angle snapping with input-boundary freezes that don’t rotate the view to a target.

  2. Keep mouse movement available after throwing the pearl; freeze below the throw angle for up to 0.5 seconds, canceled by throwing a wind charge.

Updated the aim behavior without snapping your view: while holding a pearl, looking up stops mouse rotation at a randomly chosen angle from 125°–145°. After the pearl is thrown, mouse movement resumes until you look 3°–6° below the throw angle, then freezes for 0.5 seconds or until you throw a wind charge.

The mouse handling is client-side and doesn’t add or change network packets.

Jerricks

now make it so after i throw the pearl at that angle i cant throw the windcharge until i reach the angle the it freezes my screen at

Kodari AI
KodariNov 8 at 2:25 pm 1
  1. Block wind-charge item use while the post-pearl angle is still pending.

  2. Allow use as soon as the mouse freeze angle is reached, preserving the existing 0.5-second lock/cancel behavior.

Wind charges are now blocked after a pearl throw until you look down to the post-throw freeze angle. Once you reach that angle and the screen freezes, you can throw the wind charge; it still cancels the freeze as before.

Jerricks

only freeze my screen after the pearl throw if i throw it between the degrees set any other pearl throw works as normal

Kodari AI
KodariNov 8 at 2:34 pm 1

Post-pearl freeze now only arms when the pearl is thrown between 125° and 145° inclusive. Throws outside that range won’t trigger the follow-up freeze or block wind charges.

Jerricks

no dont like randomly freeze it between those if im holding the pearl and start looking up it stops immendiatelt at 125 if i hold the pearl while im already looking at 130 then it freezes at 130

Kodari AI
KodariNov 10 at 1:57 pm 1
  1. Replace the random pearl angle with a fixed 125° threshold.

  2. If a pearl is already held above that threshold, freeze at the current angle; otherwise freeze as soon as upward movement reaches 125°.

The pearl aim freeze is now deterministic: while holding a pearl, looking up stops at 125°. If you’re already looking above 125° when the pearl is detected, it freezes at your current angle instead.

Jerricks

actually after i throw the pearl instantly look down for me to the angle that id need to throw the windcharge

Kodari AI
KodariNov 12 at 2:30 am 1
  1. Keep pearl throws outside 125°–145° unchanged.

  2. For throws inside that range, immediately turn down 3°–6° and hold that angle for 0.5 seconds or until a wind charge is thrown.

Pearl throws between 125° and 145° now immediately turn your view 3°–6° downward and freeze it there for 0.5 seconds, or until you throw a wind charge. Throws outside that range remain unaffected.

Jerricks

make it so i can set a keybind to snap to that angle once im holding the pearl i mean snap between 125-145 for the pearl throw

Kodari AI
KodariNov 13 at 9:18 pm 1
  1. Add a configurable client keybind that, while holding an ender pearl, snaps your view to a random angle from 125°–145°.

  2. Keep the existing automatic mouse-freeze and post-throw behavior unchanged.

Added a Snap pearl throw angle keybind, defaulting to G. While holding an ender pearl, press it to snap to a randomly selected angle from 125°–145°; you can remap the key in Controls.

Jerricks

actually remove that make it so if im 20 blocks or more in the air and click z it works as my normal keybind but it always snaps me to those angles

Kodari AI
KodariNov 14 at 3:59 pm 1
  1. Move the snap trigger from G to Z and keep it pearl-only.

  2. Only allow the snap when a downward block raycast confirms at least 20 blocks of clearance.

Changed the snap keybind from G to Z. While holding an ender pearl, pressing Z snaps to a random angle from 125°–145° only when there are at least 20 clear blocks below you; at lower heights it does nothing.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
9 354
src/client/java/com/kodari/lookangle/LookAngleMod.java
package com.kodari.lookangle;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RaycastContext;
import org.lwjgl.glfw.GLFW;

import java.util.concurrent.ThreadLocalRandom;

public class LookAngleMod implements ClientModInitializer {
    private static boolean hasPreviousItemCounts;
    private static int previousPearlCount;
    private static int previousWindChargeCount;
    private static boolean pearlFreezeArmed;
    private static boolean pearlFreezeReached;
    private static float pearlFreezeDegrees;
    private static boolean waitingForDownwardLook;
    private static float pearlThrowDegrees;
    private static float postThrowFreezeDegrees;
    private static boolean postThrowFreezeActive;
    private static int postThrowFreezeTicks;
    private static KeyBinding pearlSnapKey;

    @Override
    public void onInitializeClient() {
        pearlSnapKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.lookangle.snap_pearl_angle",
                GLFW.GLFW_KEY_Z,
                KeyBinding.Category.MISC
        ));
        ClientTickEvents.END_CLIENT_TICK.register(LookAngleMod::tick);
        HudElementRegistry.addLast(Identifier.of("lookangle", "angle"), (context, tickCounter) -> {
            var cameraEntity = MinecraftClient.getInstance().getCameraEntity();
            if (cameraEntity == null) {
                return;
            }

            int degrees = Math.round(90.0f - cameraEntity.getPitch());
            String label = "Look: " + degrees + "°";
            int x = (context.getScaledWindowWidth() - MinecraftClient.getInstance().textRenderer.getWidth(label)) / 2;
            int y = context.getScaledWindowHeight() / 2 + 8;
            context.drawText(
                    MinecraftClient.getInstance().textRenderer,
                    Text.literal(label),
                    x,
                    y,
                    0xFFFFFFFF,
                    true
            );
        });
    }

    private static void onPearlThrown(PlayerEntity player) {
        pearlThrowDegrees = 90.0f - player.getPitch();
        pearlFreezeArmed = false;
        pearlFreezeReached = false;
        waitingForDownwardLook = false;
        postThrowFreezeActive = false;
        postThrowFreezeTicks = 0;
        if (pearlThrowDegrees < 125.0f || pearlThrowDegrees > 145.0f) {
            return;
        }

        postThrowFreezeDegrees = Math.max(0.0f, pearlThrowDegrees - ThreadLocalRandom.current().nextInt(3, 7));
        waitingForDownwardLook = false;
        postThrowFreezeActive = true;
        postThrowFreezeTicks = 10;
        freezeAtDegrees(player, postThrowFreezeDegrees);
    }

    private static void onWindChargeThrown() {
        pearlFreezeArmed = false;
        pearlFreezeReached = false;
        waitingForDownwardLook = false;
        postThrowFreezeActive = false;
        postThrowFreezeTicks = 0;
    }

    public static void handleMouseLook(PlayerEntity player, double cursorDeltaX, double cursorDeltaY) {
        if (pearlFreezeReached || postThrowFreezeActive) {
            return;
        }

        float currentDegrees = 90.0f - player.getPitch();
        float nextDegrees = currentDegrees - (float) cursorDeltaY * 0.15f;

        if (pearlFreezeArmed && nextDegrees > currentDegrees && nextDegrees >= pearlFreezeDegrees) {
            freezeAtDegrees(player, Math.max(currentDegrees, pearlFreezeDegrees));
            pearlFreezeReached = true;
            return;
        }

        if (waitingForDownwardLook && nextDegrees < currentDegrees && nextDegrees <= postThrowFreezeDegrees) {
            freezeAtDegrees(player, Math.min(currentDegrees, postThrowFreezeDegrees));
            waitingForDownwardLook = false;
            postThrowFreezeActive = true;
            postThrowFreezeTicks = 10;
            return;
        }

        player.changeLookDirection(cursorDeltaX, cursorDeltaY);
    }

    public static boolean shouldBlockWindCharge(PlayerEntity player, Hand hand) {
        return waitingForDownwardLook && player.getStackInHand(hand).isOf(Items.WIND_CHARGE);
    }

    private static void freezeAtDegrees(PlayerEntity player, float degrees) {
        float targetPitch = 90.0f - degrees;
        double clampedDeltaY = (targetPitch - player.getPitch()) / 0.15f;
        player.changeLookDirection(0.0, clampedDeltaY);
    }

    private static boolean isAtLeastTwentyBlocksAboveGround(PlayerEntity player) {
        double x = player.getX();
        double z = player.getZ();
        double y = player.getY();
        Vec3d start = new Vec3d(x, y, z);
        Vec3d end = new Vec3d(x, y - 20.0, z);
        HitResult hit = player.getEntityWorld().raycast(new RaycastContext(
                start,
                end,
                RaycastContext.ShapeType.COLLIDER,
                RaycastContext.FluidHandling.NONE,
                player
        ));
        return hit.getType() == HitResult.Type.MISS || hit.getPos().y <= end.y;
    }

    private static void tick(MinecraftClient client) {
        boolean snapRequested = false;
        while (pearlSnapKey.wasPressed()) {
            snapRequested = true;
        }

        PlayerEntity player = client.player;
        Entity cameraEntity = client.getCameraEntity();
        if (player == null || cameraEntity == null) {
            hasPreviousItemCounts = false;
            pearlFreezeArmed = false;
            pearlFreezeReached = false;
            waitingForDownwardLook = false;
            postThrowFreezeActive = false;
            postThrowFreezeTicks = 0;
            return;
        }

        int pearlCount = player.getInventory().count(Items.ENDER_PEARL);
        int windChargeCount = player.getInventory().count(Items.WIND_CHARGE);
        if (hasPreviousItemCounts) {
            if (pearlCount < previousPearlCount) {
                onPearlThrown(player);
            }
            if (windChargeCount < previousWindChargeCount) {
                onWindChargeThrown();
            }
        } else {
            hasPreviousItemCounts = true;
        }
        previousPearlCount = pearlCount;
        previousWindChargeCount = windChargeCount;

        boolean holdingPearl = player.getStackInHand(Hand.MAIN_HAND).isOf(Items.ENDER_PEARL)
                || player.getStackInHand(Hand.OFF_HAND).isOf(Items.ENDER_PEARL);
        if (snapRequested && holdingPearl && isAtLeastTwentyBlocksAboveGround(player)) {
            pearlFreezeDegrees = ThreadLocalRandom.current().nextInt(125, 146);
            pearlFreezeArmed = true;
            pearlFreezeReached = true;
            freezeAtDegrees(player, pearlFreezeDegrees);
        }

        if (!holdingPearl) {
            pearlFreezeArmed = false;
            pearlFreezeReached = false;
        } else if (!pearlFreezeArmed && !waitingForDownwardLook && !postThrowFreezeActive) {
            float currentDegrees = 90.0f - player.getPitch();
            pearlFreezeDegrees = 125.0f;
            pearlFreezeArmed = true;
            if (currentDegrees >= pearlFreezeDegrees) {
                pearlFreezeDegrees = currentDegrees;
                pearlFreezeReached = true;
            }
        }

        if (postThrowFreezeActive && --postThrowFreezeTicks <= 0) {
            postThrowFreezeActive = false;
        }
    }