Максим Okak

I want a mod that makes the camera follow the player like in Terraria, i.e., from the side, and let the world generation also be like in Terraria, but! With blocks from Minecraft and the same structures.

Kodari AI
KodariOct 25 at 11:04 am 4
TerrariaCameraMod
Transforms Minecraft's camera perspective to a side-scrolling Terraria-style view, locking the camera to follow the player horizontally while maintaining vertical freedom. The mod also alters world generation to create Terraria-like terrain with distinct surface, underground, and cave layers, while preserving Minecraft's block palette and structures. Features include dynamic camera smoothing, terrain height variation, and biome-specific underground generation.
  1. Add a fixed side-follow camera for the player.

  2. Add Terraria-inspired layered terrain while retaining Minecraft blocks and structures.

  1. Added a fixed side-follow camera, keeping the player visible in the view.

  2. Added a Terraria-Inspired World preset with rolling terrain, layered dirt/stone/deepslate, and caves. It uses Minecraft’s biomes and structure generation, with the vanilla Nether and End.

Choose the preset when creating a new world; existing worlds are unchanged. Player movement remains 3D.

Максим Okak

Okay, just change a few things in this mod: When I talked about generation like in Terraria, I meant that the world should be in 2D! (And make it so that when you create a world, there’s a “Terraria Generation” button in the corner, and you need to enable it for the world to be generated that way. Also, change the controls: W (or Space) — Jump, S (or Shift) — Crouch, D — Walk right, A — Walk left. Important: A and D will move you left and right regardless of your direction of view. Also, change the cursor behavior — it can move across the entire screen, and the player will follow it with their head. (And one more thing about the generation — in addition to being in 2D, it should itself be similar to Terraria’s generation.) Thank you!

Kodari AI
KodariOct 25 at 4:20 pm 6
  1. Update the side-view camera, movement controls, and cursor-driven head tracking.

  2. Make Terraria-style 2D generation opt-in from the new-world creation screen.

  1. Controls/cursor: added keyboard platform controls, fixed left/right movement, free cursor aiming, and depth locking.

  2. Generation: I’m locating the current preset and world-creation hooks before making the 2D mode opt-in.

  • Added Terraria Generation: OFF/ON in the top-right of the new-world screen. It defaults to OFF; turn it on before creating a world to use the custom generator.

  • Enabled worlds now generate a 2D terrain slice with layered grass, dirt, stone and deepslate, caves, and sandy, water-filled lowlands. Vanilla biomes and structure generation remain enabled.

  • Updated controls: A/D move left/right along the world regardless of facing; W or Space jumps; S or Shift crouches. The cursor stays free across the screen and steers the player’s head.

  • Existing worlds are unchanged.

Максим Okak

Got it! But there’s still something that needs to be changed: right now, when I move the mouse to the right, the player looks to the left — that shouldn’t happen. I’ll explain in detail how it should work: the block the cursor is pointing at should be the target block the player is looking at. For example, the cursor is pointing at the sand next to the player, and the player should be looking at that block. If you hold down the LMB, the player will start mining that block. The same goes for mobs, but there’s a reach limitation — 5 blocks. AND THE MOST IMPORTANT THING!!! Change the rules for generating vegetation and mobs (so that trees, grass, and any other mobs only need 1 block in width (i.e., the width of this world) to spawn).

Kodari AI
KodariOct 25 at 5:11 pm 8
  1. Fix cursor aiming so the player faces and interacts with the block or mob under the cursor, enforcing a 5-block mob reach.

  2. Adjust 2D-world spawning so vegetation and mobs can spawn in the one-block-wide world.

  1. Adapt the 2D generator’s vegetation and mob spawning for the one-block world thickness.

  • Cursor aiming now targets the block or entity beneath it. The player faces the actual target, and vanilla left-click mining uses that cursor-selected block.

  • Mob targeting is capped at 5 blocks, with the interaction range set on both client and server.

  • In Terraria Generation worlds, biome features are placed along the one-block-wide slice, and chunk-generation and natural mob spawning are directed to that slice. The option remains limited to new worlds created with the toggle enabled.

Максим Okak

Thank you!!! There’s something else that needs to be changed: Make it so that the hand (the one that isn’t part of the player model but is displayed on the screen) is not visible. THE MOST IMPORTANT THING: For some reason, you can only break blocks that are destroyed with a single hit (for example, grass); I don’t know why, but it’s most likely because the cursor that comes from Minecraft itself (the cross) is located in the middle of the screen. You could make it movable and remove the other cursor that comes from Windows. And if possible, could you add some kind of background just for visual appeal, so that there isn’t some kind of empty space at the back? Thanks!

Kodari AI
KodariOct 25 at 5:58 pm 5
  1. Hide the first-person rendered hand.

  2. Fix cursor-driven block breaking so multi-hit blocks can be mined.

  3. Add a subtle visual background behind the 2D world.

  • Hidden the rendered first-person arm while keeping held items visible.

  • Fixed held-click mining progression with the free cursor; the in-game crosshair now follows the mouse, and the Windows pointer is hidden during gameplay.

  • Next: add a visual backdrop behind the 2D world.

  • Hid the first-person arm while keeping held items visible.

  • Fixed held-click mining with the free cursor. The crosshair now follows the mouse, and the Windows pointer is hidden during gameplay but shown again in menus.

  • Added a client-side gradient backdrop with distant hills behind the terrain.

Максим Okak

Uh-oh... After the latest mod update, Minecraft stopped launching... This needs to be fixed.

Kodari AI
KodariOct 25 at 6:12 pm 1
  1. Trace the recent client mixins and backdrop for a launch-time failure.

  2. Fix the offending code and verify the relevant configuration.

The backdrop added a Fabric API render-event dependency, but Fabric API wasn’t declared in the project. Added Fabric API 0.161.0+26.3 to Gradle and declared it as a required mod dependency, preventing the missing-class launch failure.

Максим Okak

It still doesn’t work! The launcher displays an error: “Failed to launch the Mod Pack. Most likely, the problem is due to installed mods or resource packs. (Incompatibility with certain mods or low‑quality mods) We recommend disabling all mods, checking whether it works without them, and then activating them one by one or in groups to figure out which one is causing the issue.(Try installing different versions of the problematic mod or resource pack)

Kodari AI
KodariOct 25 at 6:40 pm 2
  1. Trace the latest changes for launch-time incompatibilities, especially the new mixins and Fabric API setup.

  2. Fix the most likely startup failure in the project. If the available files don’t identify it, I’ll need the crash report to pinpoint it.

The launcher message is generic and doesn’t identify the crashing mod or cause. I checked the recent mixin targets and Fabric API calls against the 26.3 sources, but didn’t find a confirmed launch-breaking mismatch, so changing more code now would be guesswork.

Please send the crash report (.minecraft/crash-reports/crash-….txt) or latest.log from .minecraft/logs/. The lines around Caused by: or Mixin apply failed should pinpoint what needs fixing.

Максим Okak

Oh, I don’t know what’s causing this, but I can’t get in touch with support. Okay, let’s try removing the background for the 2D world — maybe that’s what’s causing the error.

Kodari AI
KodariOct 25 at 6:46 pm 1
  1. Remove the backdrop renderer and its client initialization.

  2. Remove the Fabric API dependency, which was only used by that renderer.

Removed the 2D background renderer and its registration, and removed Fabric API from the build and mod dependencies since nothing else uses it. The side-view camera and world generation remain unchanged.

Compile the project and try launching again. If it still fails, the crash report will be needed to identify the next cause.

Максим Okak

Oh my God, I’m so tired. Okay, leave it as “make it so that the hand (the one that isn’t part of the player model but is displayed on the screen) isn’t visible.” MOST IMPORTANT: for some reason, you can only destroy blocks that can be destroyed with a single hit (for example, grass). I don’t know why, but it’s most likely because the Minecraft cursor (the cross) is located in the center of the screen. You could make it movable and remove the other cursor that is used in Windows. And if possible, could you add some background for visual appeal so that there’s no empty space at the back? The only thing that needs to be fixed is the bug where it’s not possible to break blocks that don’t break with a single hit (i.e., you have to hold down the LMB button).

Kodari AI
KodariOct 25 at 6:57 pm 1

Removed the per-tick mouse release that was interrupting Minecraft’s held attack, so breaking blocks should now continue while you hold LMB. Compile the mod and test it on a block that takes multiple hits.

Максим Okak

THE MOD IS STILL NOT STARTING... okay, look, remove everything from this prompt: “Thank you!!! There’s still something else to change: make it so that the hand (the one that isn’t part of the player model but is displayed on the screen) isn’t visible. MOST IMPORTANT: for some reason, you can only destroy blocks that can be destroyed with a single hit (for example, grass). I don’t know why, but it’s most likely because the Minecraft cursor (the cross) is located in the center of the screen.” You could make it movable and remove the other cursor that is used in Windows. And if possible, could you add some kind of background for visual appeal so that there’s no empty space behind it? Thank you! And just fix the bug where you can’t break anything that doesn’t break in one hit, okay?

Kodari AI
KodariOct 25 at 7:10 pm 3
  1. Remove the hand-hiding and movable/free-cursor mixins, returning the crosshair and mouse capture to vanilla behavior.

  2. Keep the side-view targeting ray, but hold onto its last valid block hit during a brief miss while LMB is held, so vanilla’s continuous mining isn’t reset.

Removed the hand-hiding and custom cursor mixins, restoring vanilla hand, crosshair, and mouse capture. Kept the side-view targeting ray, but it now holds the last valid block target through a brief ray miss while LMB stays held and the block remains in range—preventing Minecraft from resetting mining progress. The background remains removed.

Максим Okak

Bro!!! It worked!!! Look: by elimination: first we removed the background — it didn’t work — then we also removed the option to disable the first‑person hand display, and it worked!!! So the problem was that we made it so that the first‑person hand wasn’t visible, and that broke everything! Can you somehow make it so that it’s not visible, but the game doesn’t break? Hahaha!

Kodari AI
KodariOct 25 at 7:21 pm 1
  1. Hide only the first-person arm by cancelling the renderer’s arm-only helper, leaving held-item rendering and mining untouched.

  2. Register the client mixin.

Added a renderer-only mixin that hides the first-person arm without cancelling held-item rendering or changing mining/input behavior. This targets the 26.3 arm-rendering helper, rather than disabling the entire first-person renderer.

Compile and test in-game; the arm should be hidden while items and block breaking still work.

Максим Okak

You did great! But there’s still something that needs to be fixed: the cursor isn’t visible, and that’s good, but instead of it, the cross‑shaped cursor that Minecraft added (you know, that little cross in the center of the screen) should move across the screen — it should act as the cursor.

Kodari AI
KodariOct 25 at 7:44 pm 2
  1. Make the in-game crosshair track the mouse position.

  2. Keep the working mining target logic and first-person arm hiding unchanged.

  3. Show/release the gameplay mouse cursor only as needed for pointer control.

The gameplay mouse is now released so the pointer can move, and the vanilla crosshair follows it instead of staying centered. The existing cursor-based targeting, continuous block breaking, and first-person arm hiding remain in place. Compile and test in-game.

Максим Okak

A small error occurred: generally, the crosshair follows the cursor, but if you press the left mouse button, the cursor, along with the crosshair, moves to the center of the screen, and I can’t even hit the block once or try to break it — this action is interrupted.

Kodari AI
KodariOct 25 at 7:57 pm 2
  1. Prevent only the gameplay click’s automatic mouse grab, so the pointer stays where it is.

  2. Let Minecraft’s held-attack tick continue while the pointer is intentionally ungrabbed.

Fixed the click behavior: gameplay clicks no longer grab and recenter the mouse, and held attacks can still advance while the pointer is ungrabbed. The crosshair should stay under the pointer when you click, and block breaking should remain uninterrupted. Compile and test it in-game.

Максим Okak

It seems we need to roll back the latest updates; the game won’t launch again because of the mod... However, we still need to somehow solve the problem where we can’t attack or destroy because the action has been interrupted.

Kodari AI
KodariOct 25 at 8:11 pm 2
  1. Roll back the latest cursor/mouse mixin changes that are preventing startup, while preserving the previously working arm-hiding setup.

  2. Re-check the attack flow and make the smallest safe change so clicks and held mining aren’t interrupted.

Replaced the recent mouse-button wrapper with a simpler cancellable hook on grabMouse(). It should keep gameplay clicks from recentering the pointer while preserving the attack-continuation change and cursor targeting.

Compile and try launching again. If it still won’t start, send the crash report or latest log—the exact startup error will identify the failing mixin.

Максим Okak

Another error when launching. Okay, just delete the last changes (up to the point where you made the cross‑shaped button movable) And leave the cross‑shaped button in the center, but make the mouse visible.

Kodari AI
KodariOct 25 at 8:19 pm 1
  1. Remove the crosshair-position and mouse-grab mixins that were added for movable-cursor behavior, restoring the centered crosshair and avoiding those startup hooks.

  2. Keep the existing visible-pointer release and mining/targeting logic in place.

Removed the movable-crosshair and mouse-grab mixins that could prevent startup. The crosshair is centered again, the existing tick logic still releases the mouse so the pointer stays visible, and the mining fix remains in place. Compile and test the mod.

Максим Okak

Uh... Well, you know... Minecraft still won’t launch... What’s the problem? Can you track down which update version the mod needs to be rolled back to? And once you’ve tracked it down, roll it back to the version when the mod still worked.

Kodari AI
KodariOct 25 at 8:30 pm 1
  1. Roll back the mouse-grab attack hook: its mixin targets an isMouseGrabbed() call inside tick(), but 26.3 calls that method from handleKeybinds(), making the required injection fail during launch.

  2. Keep the confirmed-working mouse release and cursor-targeting code; the crosshair remains centered.

I found and rolled back the launch-breaking hook in MinecraftMixin. It tried to modify isMouseGrabbed() inside Minecraft.tick(), but Minecraft 26.3 calls it from handleKeybinds() instead. Since the mixin requires that injection to match, startup could fail.

There’s no Git history or version record in the project, so I can’t name a specific version number. The bad hook is removed; mouse visibility and the centered crosshair are preserved.

Максим Okak

Happy new day! Look, there’s another bug — if I press LMB, the mouse cursor moves to the center of the screen, and the action can’t be performed. Fix it carefully without breaking the game code, haha.

Kodari AI
KodariOct 26 at 7:43 am 1
  1. Stop the game from grabbing/recentering the mouse while a world is active.

  2. Cancel only the grab operation, so the same left-click still reaches Minecraft’s attack binding.

  3. Leave the centered crosshair and existing cursor-based targeting unchanged.

Added a guarded MouseHandler.grabMouse() hook: while a world is active it prevents mouse capture and recentering, but doesn’t cancel the mouse-button event. Minecraft’s left-click still reaches its attack binding. The centered crosshair and cursor-based targeting are unchanged.

Please compile and test in-game; I haven’t verified this change by launching the game.

Максим Okak

Good job! But now you can only hit and break the blocks that break with a single hit; the others can’t be broken because it’s a hit, not a break.

Kodari AI
KodariOct 26 at 8:04 am 2
  1. Trace how cursor targeting and held block breaking currently interact.

  2. Identify why continuous mining becomes a single hit, then make the smallest safe fix without changing the cursor/crosshair behavior.

Fixed the multi-hit mining interruption. Minecraft only continues breaking while isMouseGrabbed() is true; since the mod keeps the mouse released, its held-attack check was stopping the break after the initial hit.

I changed only that check inside handleKeybinds() to allow continued attacks while a world is active. The mouse remains visible, and other uses of isMouseGrabbed()—including player turning and resize behavior—are unchanged. Compile and test in-game.

Максим Okak

Yeah! Just fix this: I can’t hit mobs. I spawned a piglet, and when I hover the cursor over it and press LMB, nothing happens. However, the attack indicator fills up — so the attack is being performed, but it’s not hitting the mob. Most likely, this is because the cross‑shaped button embedded in Minecraft is in the center, and because of that, the attack is triggered, but it’s not the cursor that’s being tracked — it’s the cross‑shaped button. Don’t move the cross‑shaped button; just do it the same way you did with breaking blocks, but with the attack so that the cursor is tracked, not the button. Okay?

Kodari AI
KodariOct 26 at 8:34 am 4
  1. Trace Minecraft’s actual entity-attack dispatch against the cursor-selected target.

  2. Adjust only attack targeting if the crosshair target is being ignored; preserve the fixed center crosshair and cursor-based block mining.

Updated held-attack handling: while LMB is held, Minecraft now retries its normal attack when the cooldown is ready and the cursor-selected target is an entity. That reuses the existing cursor-based hit result, leaves the crosshair centered, and keeps vanilla attack checks intact.

Compile and test by holding LMB over a mob; attacks should follow the cursor as the cooldown refills.

Максим Okak

Anyway, the attack doesn't work (... Okay, look, try to tie the crosspiece to the cursor, but very carefully so that it doesn't break the game and cause errors

Kodari AI
KodariOct 26 at 8:45 am 2
  1. Trace the current cursor targeting and centered crosshair code, including recent attack hooks.

  2. Check the 26.3 HUD/crosshair APIs and mixin targets from source, then make the smallest safe cursor-following change while preserving mouse visibility.

Moved the built-in crosshair to the visible cursor using the same scaled mouse coordinates as cursor targeting. The change only redirects the crosshair’s draw position; it leaves mouse capture, attack/mining logic, and the centered crosshair target calculations untouched.

I verified the mixin target against the 26.3 source, but haven’t launched the game to test it.

Максим Okak

Great, but the attack is still broken. Please try to fix it somehow.

Kodari AI
KodariOct 26 at 9:31 am 3

Updated the attack path to recalculate the cursor target immediately before Minecraft processes each attack. Previously, attacks could use a stale hit result even though the crosshair was drawn at the cursor. The crosshair stays where it is; no camera or mouse-grab behavior changed.

Максим Okak

Well, I don’t know, the attack isn’t working at all. Make it so that when the player attacks, it’s not the direction they’re looking at that’s tracked, but the position of their cursor — the cross‑shaped indicator — and if it’s within the mob’s hitbox, then the attack should land.

Kodari AI
KodariOct 26 at 10:57 am 2

I found the targeting bug: cursor coordinates were converted into a camera-local ray, but then used as if they were world coordinates. I’ll rotate that ray into the camera’s actual world direction; attack handling and crosshair placement stay untouched.

Fixed the cursor ray in MinecraftMixin: it now rotates the screen-derived direction by the camera’s world rotation before checking blocks and entity hitboxes. Previously it treated camera-local coordinates as world coordinates, so attacks could target the wrong place when the camera was turned.

Attack handling and crosshair placement are unchanged. I haven’t launched the game to verify it in-game.

Максим Okak

...It’s still not working... I don’t know what to do anymore... Even if you move the cursor along with the cross‑shaped button to any mob and press LMB, the mob still won’t take damage. Try making it so that the attack indicator moves along with the cursor, and also fix that bug somehow, please.

Kodari AI
KodariOct 26 at 12:23 pm 2
  1. Trace the attack indicator cooldown and entity attack code alongside cursor raycasting.

  2. Verify the relevant Minecraft 26.3 attack, hit-result, and input signatures from source.

  3. Make the cursor’s hit result drive both the indicator feedback and actual mob attack, without changing mouse capture.

Updated both cursor targeting and attack feedback:

  • Entity checks now run along the full cursor ray instead of stopping at the first block hit, so a block hit won’t discard the mob target under the cursor.

  • The attack indicator—full, background, and cooldown progress—now follows the cursor with the crosshair.

I haven’t launched the game to verify the hit behavior. This also means a mob on the cursor ray can be selected even when a block is between it and the camera.

Максим Okak

OH MY GOD!!! The hit on mobs still isn’t working!!! Okay, you know what? You can use emergency measures to fix this—this is probably the tenth attempt.

Kodari AI
KodariOct 26 at 12:44 pm 2
  1. Trace the attack and cursor-hit path to find why the previous fixes still do not produce entity damage.

  2. Verify the exact 26.3 attack APIs involved, then replace the broken targeting hook with a direct cursor-to-entity attack path.

Fixed the actual aim rotation: the cursor picker changed only the player’s head angle, while LocalPlayer uses body yaw for its view direction—and the mod reset that yaw to zero every tick. The player’s real yaw now follows the cursor, and the tick reset is removed. The side camera and cursor-positioned crosshair are unchanged.

I haven’t launched the game to verify the attack in-game.

Максим Okak

Roll back the last change! Make it so that only the head rotates as before, and to fix that bug, try this: Most likely, you only changed the client-side part (camera rendering), but didn’t tell the server where the player is actually “looking” from. The server continues to perform raycasting from player.getEyePosition(), not from your camera’s position.

What to check:

Find in your code (or in the base mod’s code) the place where the attack occurs. If you use Minecraft.getInstance().crosshairPickEntity or similar client fields, the server doesn’t know about it.

You need to either send a custom packet to the server with information about the target (the ID of the entity you’ve hovered over) or override the server‑side raycast so that it uses your new camera position.

Kodari AI
KodariOct 28 at 11:14 am 3
  1. Restore head-only rotation and identify the existing client/server attack flow.

  2. Verify the 26.3 networking and attack APIs, then send cursor-selected target info to the server and apply it safely during attacks.

Restored head-only yaw; body yaw is no longer changed.

Entity attacks now send the cursor-selected entity ID to the server. The server passes it through Minecraft’s normal attack handler, preserving its reach and attackability checks. I also added the Fabric networking dependency and server payload registration. I haven’t verified this in-game yet.

Максим Okak

It’s still not working, try this: the client-side “hit” check doesn’t find the mob.

In some Forge/Fabric versions, the client itself decides whether you hit the mob, and if so, it sends a ServerboundInteractPacket. If your modified camera view isn’t synchronized with the HitResult (which is built by GameRenderer), the client may simply not see the mob under the cursor.

What to check:

Make sure your camera code correctly updates Minecraft.getInstance().hitResult (or crosshairTarget in newer versions). If hitResult points to a block (or to nothing), even though you visually aimed at the mob, the attack will not go through.

In Fabric/Forge, there are hooks on GameRenderer#pick

Kodari AI
KodariOct 28 at 11:23 am 1

I’ll trace the current client hit-result update and attack packet path, then make cursor targeting feed Minecraft’s actual hit result while preserving head-only rotation.

The cursor hit test has a concrete distance-units bug: ProjectileUtil compares squared hit distance, but this code passed a linear ray length. With the camera offset behind the player, that rejects mobs at the cursor before hitResult can become an entity hit.

  1. Pass the squared ray length to the entity picker.

  2. Keep the existing cursor-derived hitResult/crosshairPickEntity update and server attack validation.

  3. Leave the head-only rotation and camera behavior unchanged.

Fixed the entity hit test in MinecraftMixin: ProjectileUtil.getEntityHitResult expects its maximum distance in squared units, but the cursor ray supplied a regular distance. Since the camera sits offset from the player, that mismatch rejected mobs before the cursor hit could update Minecraft.hitResult.

The picker now receives the squared ray length. The existing cursor hit result feeds the attack path; head-only rotation and the server’s normal attack checks are unchanged. I haven’t verified this in-game.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
25 1,083
src/client/java/com/kodari/terrariacamera/client/TerrariaCameraClient.java
package com.kodari.terrariacamera.client;

import io.wispforest.owo.ui.component.ButtonComponent;
import io.wispforest.owo.ui.component.UIComponents;
import io.wispforest.owo.ui.container.UIContainers;
import io.wispforest.owo.ui.core.Insets;
import io.wispforest.owo.ui.core.Positioning;
import io.wispforest.owo.ui.layers.Layers;
import net.fabricmc.api.ClientModInitializer;
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
import net.minecraft.network.chat.Component;

public final class TerrariaCameraClient implements ClientModInitializer {
	@Override
	public void onInitializeClient() {
		Layers.add(UIContainers::verticalFlow, instance -> {
			TerrariaGenerationSelection.setEnabled(false);
			ButtonComponent button = UIComponents.button(
				Component.translatable("terraria_camera.generation.off"),
				clickedButton -> {
					boolean enabled = !TerrariaGenerationSelection.isEnabled();
					TerrariaGenerationSelection.setEnabled(enabled);
					clickedButton.setMessage(Component.translatable(enabled
						? "terraria_camera.generation.on"
						: "terraria_camera.generation.off"));
				}
			);
			button.margins(Insets.of(6));
			button.positioning(Positioning.relative(100, 0));
			instance.adapter.rootComponent.child(button);
		}, CreateWorldScreen.class);
	}
}