Alin-J178

I want to create a Minecraft Java Edition mod that adds a companion bot named Bob to my single-player world. My main goal is to build a solid foundation before adding any advanced features like AI or an LLM.

Bob should behave like a real companion rather than a simple mob. He should be able to spawn into the world, follow me, stay in one place, walk to a location, stop what he is doing, and teleport back to me if he gets stuck or is too far away. He should avoid dangerous areas such as lava, cliffs, and fire, and use Minecraft's normal pathfinding so his movement feels natural.

For the first version, I only want to control Bob using simple commands such as spawning, following, staying, moving, checking his status, and removing him. I also want Bob to remember who his owner is and save his data when I leave the world so he is still there when I come back.

The code should be clean, modular, and easy to expand in the future. I plan to add more features later, including mining, farming, combat, inventory management, building, and eventually connecting Bob to an LLM so I can give him natural language commands. However, those features are not important yet. Right now, I want to focus on creating a stable, reliable companion that works well in single-player before adding any AI capabilities.

Please build the project step by step instead of generating everything at once. I want each phase to be complete and testable before moving on to the next one.

Kodari AI
KodariJul 16 at 5:41 am 9
BobCompanion
BobCompanion is a Fabric 1.21.11 single-player companion mod that provides a persistent Bob entity with owner tracking and reliable command control. The foundation supports spawning, following, staying, walking to a position, stopping, status inspection, removal, safe natural pathfinding, and recovery teleportation when Bob is stranded or too far away. Its modular structure leaves clear extension points for future mining, farming, combat, inventory, building, and LLM-driven behavior.

1Phase plan:

  1. Create the Fabric 1.21.11 project and split common/client source sets.

  2. Register Bob with persistent owner data, safe navigation, recovery behavior, and a client renderer.

  3. Add /bob commands for spawn, follow, stay, move, stop, status, and remove.

  4. Add the required assets and mixin configuration so the phase is testable in-game.

A Fabric 1.21.11 Minecraft mod that adds Bob, a persistent single-player companion with owner memory, natural navigation, follow, stay, move, stop, status, and removal commands. Bob uses a dedicated entity with saved behavior state, recovers when he becomes stuck or too distant, and avoids hazardous situations through server-side safety checks. The modular foundation is designed for future mining, farming, combat, inventory, building, and natural-language control features.

Phase 1 is ready for testing with:

  • Persistent Bob entity with saved owner and behavior state

  • /bob spawn

  • /bob follow

  • /bob stay

  • /bob move <x> <y> <z>

  • /bob stop

  • /bob status

  • /bob remove

  • Natural pathfinding with fire/lava avoidance penalties

  • Recovery when Bob is stuck, on fire, in lava, or more than 64 blocks away

  • Fabric 1.21.11 split client/common source sets and renderer

Test this phase in-game before continuing with advanced companion systems.

Alin-J178

The compilation failed with this error:

code
Compilation failed with 20 error(s):

ERROR in src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 3: cannot find symbol
import net.minecraft.client.model.EntityModel;
                                 ^
  symbol: class EntityModel
  location: package net.minecraft.client.model

ERROR in src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 13: cannot find symbol
public class BobModel extends EntityModel<BobRenderState> {
                              ^
  symbol: class EntityModel

ERROR in src/main/java/com/kodari/bobcompanion/BobCommands.java at line 69: no suitable method found for create(ServerWorld)
        BobEntity bob = BobCompanion.BOB.create(world);
                                        ^

ERROR in src/main/java/com/kodari/bobcompanion/BobCommands.java at line 153: cannot find symbol
                world.getWorldBorder().getBox(),
                                      ^
  symbol: method getBox()
  location: class WorldBorder

ERROR in src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 32: cannot find symbol
                ModelTransform.pivot(0.0f, 18.0f, 0.0f)
                              ^
  symbol: method pivot(float,float,float)
  location: class ModelTransform

ERROR in src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 40: cannot find symbol
                ModelTransform.pivot(0.0f, 8.0f, 0.0f)
                              ^
  symbol: method pivot(float,float,float)
  location: class ModelTransform

ERROR in src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 46: method does not override or implement a method from a supertype
    @Override
    ^

ERROR in src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 48: cannot find symbol
        super.setAngles(state);
        ^
  symbol: variable super
  location: class BobModel

ERROR in src/main/java/client/java/com/kodari/bobcompanion/client/BobRenderer.java at line 9: type argument BobModel is not within bounds of type-variable M
public class BobRenderer extends MobEntityRenderer<BobEntity, BobRenderState, BobModel> {
                                                                              ^

ERROR in src/main/java/client/java/com/kodari/bobcompanion/client/BobRenderer.java at line 16: cannot find symbol
        super(context, new BobModel(context.getPart(BobCompanionClient.BOB_LAYER)), 0.35f);
                                                    ^
  symbol: variable BobCompanionClient
  location: class BobRenderer

ERROR in   src/main/java/com/kodari/bobcompanion/BobCommands.java at line 69: no suitable method found for create(ServerWorld)
          BobEntity bob = BobCompanion.BOB.create(world);
                                          ^

ERROR in   src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 3: cannot find symbol
  import net.minecraft.client.model.EntityModel;
                                   ^
  symbol: class EntityModel
  location: package net.minecraft.client.model

ERROR in   src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 48: cannot find symbol
          super.setAngles(state);
          ^
  symbol: variable super
  location: class BobModel

ERROR in   src/main/java/client/java/com/kodari/bobcompanion/client/BobRenderer.java at line 16: cannot find symbol
          super(context, new BobModel(context.getPart(BobCompanionClient.BOB_LAYER)), 0.35f);
                                                      ^
  symbol: variable BobCompanionClient
  location: class BobRenderer

ERROR in   src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 46: method does not override or implement a method from a supertype
      @Override
      ^

ERROR in   src/main/java/client/java/com/kodari/bobcompanion/client/BobRenderer.java at line 9: type argument BobModel is not within bounds of type-variable M
  public class BobRenderer extends MobEntityRenderer<BobEntity, BobRenderState, BobModel> {
                                                                                ^

ERROR in   src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 13: cannot find symbol
  public class BobModel extends EntityModel<BobRenderState> {
                                ^
  symbol: class EntityModel

ERROR in   src/main/java/com/kodari/bobcompanion/BobCommands.java at line 153: cannot find symbol
                  world.getWorldBorder().getBox(),
                                        ^
  symbol: method getBox()
  location: class WorldBorder

ERROR in   src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 32: cannot find symbol
                  ModelTransform.pivot(0.0f, 18.0f, 0.0f)
                                ^
  symbol: method pivot(float,float,float)
  location: class ModelTransform

ERROR in   src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java at line 40: cannot find symbol
                  ModelTransform.pivot(0.0f, 8.0f, 0.0f)
                                ^
  symbol: method pivot(float,float,float)
  location: class ModelTransform


=== COMPILATION ERROR ANALYSIS ===

MISSING CLASSES:
  - EntityModel
ACTION: Create these classes or check imports

MISSING METHODS:
  - getBox()
  - pivot(float,float,float)
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java
  - src/main/java/com/kodari/bobcompanion/BobCommands.java
  - src/main/java/client/java/com/kodari/bobcompanion/client/BobRenderer.java
  -   src/main/java/com/kodari/bobcompanion/BobCommands.java
  -   src/main/java/client/java/com/kodari/bobcompanion/client/BobModel.java
  -   src/main/java/client/java/com/kodari/bobcompanion/client/BobRenderer.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJul 16 at 5:44 am 10
  1. Read the verified 1.21.11 rendering, entity, and command API guidance.

  2. Inspect the affected model, renderer, commands, and client entrypoint files.

  3. Patch the incorrect APIs and source-set references without changing Bob’s behavior.

Fixed the compilation errors:

  • Moved EntityModel import to net.minecraft.client.render.entity.model.EntityModel

  • Replaced removed ModelTransform.pivot(...) with ModelTransform.origin(...)

  • Added the missing BobCompanionClient import to BobRenderer

  • Updated entity creation to use SpawnReason.COMMAND

  • Replaced removed WorldBorder.getBox() with an explicit world-border Box

  • Preserved the correct split source-set location at src/client/java/...

The corrected BobCompanion artifact is ready for compilation.

Alin-J178

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/com/kodari/bobcompanion/BobCommands.java at line 159: no suitable method found for getTopY(no arguments)
                        world.getTopY(),
                             ^

ERROR in   src/main/java/com/kodari/bobcompanion/BobCommands.java at line 159: no suitable method found for getTopY(no arguments)
                          world.getTopY(),
                               ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/bobcompanion/BobCommands.java
  -   src/main/java/com/kodari/bobcompanion/BobCommands.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJul 16 at 5:45 am 3
  1. Read the verified 1.21.11 world-height API guidance.

  2. Inspect the current BobCommands.java implementation.

  3. Replace the invalid no-argument height lookup with the correct API call.

Fixed BobCommands.java by replacing the removed no-argument world.getTopY() call with:

Java
world.getBottomY() + world.getHeight()

This produces the world’s maximum Y coordinate using the available 1.21.11 APIs.

Alin-J178

The compilation failed with this error:

code
Compilation failed with 10 error(s):

ERROR in src/main/java/com/kodari/bobcompanion/BobCommands.java at line 62: unreported exception CommandSyntaxException; must be caught or declared to be thrown
        ServerPlayerEntity player = source.getPlayerOrThrow();
                                                           ^

ERROR in src/main/java/com/kodari/bobcompanion/BobCommands.java at line 86: unreported exception CommandSyntaxException; must be caught or declared to be thrown
        ServerPlayerEntity player = source.getPlayerOrThrow();
                                                           ^

ERROR in src/main/java/com/kodari/bobcompanion/BobCommands.java at line 100: unreported exception CommandSyntaxException; must be caught or declared to be thrown
        ServerPlayerEntity player = source.getPlayerOrThrow();
                                                           ^

ERROR in src/main/java/com/kodari/bobcompanion/BobCommands.java at line 117: unreported exception CommandSyntaxException; must be caught or declared to be thrown
        ServerPlayerEntity player = source.getPlayerOrThrow();
                                                           ^

ERROR in src/main/java/com/kodari/bobcompanion/BobCommands.java at line 138: unreported exception CommandSyntaxException; must be caught or declared to be thrown
        ServerPlayerEntity player = source.getPlayerOrThrow();
                                                           ^

ERROR in   src/main/java/com/kodari/bobcompanion/BobCommands.java at line 62: unreported exception CommandSyntaxException; must be caught or declared to be thrown
          ServerPlayerEntity player = source.getPlayerOrThrow();
                                                             ^

ERROR in   src/main/java/com/kodari/bobcompanion/BobCommands.java at line 86: unreported exception CommandSyntaxException; must be caught or declared to be thrown
          ServerPlayerEntity player = source.getPlayerOrThrow();
                                                             ^

ERROR in   src/main/java/com/kodari/bobcompanion/BobCommands.java at line 100: unreported exception CommandSyntaxException; must be caught or declared to be thrown
          ServerPlayerEntity player = source.getPlayerOrThrow();
                                                             ^

ERROR in   src/main/java/com/kodari/bobcompanion/BobCommands.java at line 117: unreported exception CommandSyntaxException; must be caught or declared to be thrown
          ServerPlayerEntity player = source.getPlayerOrThrow();
                                                             ^

ERROR in   src/main/java/com/kodari/bobcompanion/BobCommands.java at line 138: unreported exception CommandSyntaxException; must be caught or declared to be thrown
          ServerPlayerEntity player = source.getPlayerOrThrow();
                                                             ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/bobcompanion/BobCommands.java
  -   src/main/java/com/kodari/bobcompanion/BobCommands.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariJul 16 at 5:46 am 3
  1. Read the verified command API guidance and current BobCommands.java.

  2. Update each command handler to propagate CommandSyntaxException through the Brigadier callback.

  3. Preserve existing command behavior and produce the corrected artifact.

Fixed BobCommands.java by declaring CommandSyntaxException on all command handlers that call source.getPlayerOrThrow():

  • spawn

  • setMode

  • move

  • status

  • remove

The corrected artifact is ready for compilation.

Alin-J178

Phase 1 functionality works correctly, but Bob’s visual model is broken.

In-game, Bob currently has:

  • An oversized floating Steve head
  • A very small torso
  • Missing or incorrectly positioned arms and legs
  • Incorrect body proportions
  • Model parts that do not align with the entity hitbox

Please fix only Bob’s model and renderer. Do not rewrite the working commands, pathfinding, ownership, state saving, or entity behavior.

I want Bob to use normal Minecraft player-like proportions:

  • Head: 8 × 8 × 8 pixels
  • Body: 8 × 12 × 4 pixels
  • Right arm: 4 × 12 × 4 pixels
  • Left arm: 4 × 12 × 4 pixels
  • Right leg: 4 × 12 × 4 pixels
  • Left leg: 4 × 12 × 4 pixels
  • Total visual height: approximately 1.8 blocks
  • Head connected correctly above the body
  • Arms positioned at both sides of the torso
  • Legs positioned below the torso
  • Model centred on the entity’s position
  • Feet aligned with ground level

Use Minecraft’s existing humanoid or player model system instead of manually creating unusual proportions where possible.

Preferred solution:

Make Bob’s model extend or reuse an appropriate built-in humanoid model class, such as PlayerEntityModel, BipedEntityModel, or the correct equivalent for Fabric Minecraft 1.21.11.

Bob should initially look like a standard Minecraft player. A normal Steve-style appearance is acceptable for now.

Also ensure:

  • Bob uses the correct entity model layer
  • The model layer is registered in the client initializer
  • The renderer uses the correct model context
  • The model scale is 1.0
  • No extra scaling transformation enlarges the head
  • The shadow radius matches a player-sized entity
  • Bob’s entity dimensions match a normal player-sized character
  • Arms and legs animate while walking
  • Arms remain visible when standing still
  • The head turns toward the direction Bob is looking
  • The model does not float above or sink into the ground
  • The texture UV coordinates match the selected model type

Check whether the current texture is a standard 64 × 64 Minecraft skin. If it is, map it using the normal player skin layout. If it is not, create a simple compatible 64 × 64 placeholder Steve-style skin and explain where to save it.

Kodari AI
KodariJul 16 at 6:10 am 20
  1. Read the verified 1.21.11 entity and rendering API guidance.

  2. Locate Bob’s model, renderer, client registration, entity dimensions, and texture.

  3. Replace only the visual/model pipeline and player-sized dimensions, preserving commands and entity behavior.

  4. Verify the corrected renderer uses the registered humanoid layer, normal scale, animation, and skin layout.

The current custom model omits all limb parts and manually uses incompatible pivots. I’m replacing it with the vanilla wide-arm player model and retaining Bob’s existing client layer/renderer pipeline, with only the player-sized shadow adjusted.

  • Replaced Bob’s custom incomplete model with Minecraft’s PlayerEntityModel using the standard wide-arm model.

  • Bob now has correctly connected head, torso, arms, legs, animation, and head tracking.

  • Updated the render state to use PlayerEntityRenderState and keep all player model layers visible.

  • Preserved the existing registered model layer and renderer context.

  • Set the player-sized shadow radius to 0.5f.

  • Kept model scale at 1.0 with no additional transformations.

  • Bob’s existing entity dimensions were already correct: 0.6 × 1.8 blocks.

  • The renderer uses Minecraft’s standard 64×64 Steve texture:

Plain Text
minecraft:textures/entity/player/wide/steve.png

No placeholder texture is required.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
14 645
src/client/java/com/kodari/bobcompanion/BobCompanionClient.java
package com.kodari.bobcompanion;

import com.kodari.bobcompanion.client.BobModel;
import com.kodari.bobcompanion.client.BobRenderer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.util.Identifier;

public class BobCompanionClient implements ClientModInitializer {
    public static final EntityModelLayer BOB_LAYER = new EntityModelLayer(
            Identifier.of(BobCompanion.MOD_ID, "bob"),
            "main"
    );

    @Override
    public void onInitializeClient() {
        EntityModelLayerRegistry.registerModelLayer(BOB_LAYER, BobModel::getTexturedModelData);
        EntityRendererRegistry.register(BobCompanion.BOB, BobRenderer::new);
    }
}