kintil555

make a mod for fun, this mod has a feature that is the player can directly change the texture of the block, for example, if you want to change the texture of a stone slab to a diamond block by shift + scrolling the mouse button, then a minecraft style INVENTORY GUI will appear to adjust the position of the texture with the shape of the block. There are also features such as NPC players who can be placed like blocks, their bodies can be moved by right-clicking on the NPC, then a INVENTORY GUI will appear where there is a slider to adjust the rotation or position of the hand

Kodari AI
KodariApr 18 at 10:33 am 62,686 (v2)

Let me read the necessary docs before planning this complex mod.

TexturePainterMod
A Fabric 1.21.4 mod with two major features: a Block Texture Painter that lets players shift+scroll on any block to open a Minecraft-style inventory GUI for selecting a replacement texture from any block in the game; and an NPC Player system where NPC entities can be spawned like blocks and right-clicking them opens a pose editor GUI with sliders to adjust left arm, right arm, head pitch, and head yaw rotations in real time.

Now let me read the block-entity and project guide before writing anything.

TexturePainterMod
A Fabric 1.21.4 mod with two major features: a Block Texture Painter that lets players shift+scroll on any targeted block to open a Minecraft-style inventory GUI for picking a replacement texture from any block in the game, replacing the block with a special TexturedBlock that renders the chosen source block visually; and an NPC Player system where humanoid NPC entities can be spawned with a dedicated item and right-clicking them opens a real-time pose editor GUI with four draggable sliders controlling left arm, right arm, head pitch, and head yaw rotations, synced to all clients via DataTracker.
  • Build + resource files first (fabric.mod.json, mixin config, blockstates, models, lang, loot tables)

  • Common Java: registry classes, TexturedBlock + BlockEntity, NpcEntity with DataTracker pose fields, three network payloads

  • Client Java: mod client init, TextureSelectorScreen (9×5 block-picker grid), NpcPoseScreen (4 draggable sliders), TexturedBlockEntityRenderer (sources block model via BlockRenderManager), NpcEntityModel/RenderState/Renderer using BipedEntityModel, MouseScrollMixin

All 30 files created. Here’s a summary of what was built:

Block Texture Painter: Shift-scrolling while looking at any block intercepts the mouse scroll event via MouseScrollMixin, opens TextureSelectorScreen — a paginated 9×5 inventory-style grid showing every block with an item icon. Clicking a block selects it (highlighted), and Apply sends UpdateTexturePayload C2S. The server replaces the target block with a TexturedBlock (a BlockEntityProvider), stores the source block ID in TexturedBlockEntity (synced to clients via toUpdatePacket), and TexturedBlockEntityRenderer calls BlockRenderManager.renderBlock with the stored block’s default state, rendering it at the position with correct lighting.

NPC Pose Editor: Placing a NpcSpawnerItem on a block surface spawns a NpcEntity (extends MobEntity, AI disabled). The entity stores 4 pose values in DataTracker<Float> fields, syncing automatically to all clients. Right-clicking sends OpenNpcScreenPayload S2C, which opens the NpcPoseScreen — four draggable PoseSliderWidget sliders (−90° to +90° for arms/head pitch, −180° to +180° for head yaw). Clicking Done sends UpdateNpcPosePayload C2S, updating the entity. The NpcEntityRenderer uses a full custom NpcEntityModel (extends BipedEntityModel) registered to player-Steve texture, with setAngles applying pose values from NpcRenderState.

kintil555

The compilation failed with this error:

code
Compilation failed with 4 error(s):

ERROR in src/main/java/com/example/texturepaint/entity/NpcEntity.java at line 8: package net.minecraft.entity.ai.attributes does not exist
import net.minecraft.entity.ai.attributes.ClampedEntityAttribute;
                                         ^

ERROR in src/main/java/com/example/texturepaint/ModBlocks.java at line 6: cannot find symbol
import net.minecraft.block.BlockSoundGroup;
                          ^
  symbol: class BlockSoundGroup
  location: package net.minecraft.block

ERROR in   src/main/java/com/example/texturepaint/ModBlocks.java at line 6: cannot find symbol
  import net.minecraft.block.BlockSoundGroup;
                            ^
  symbol: class BlockSoundGroup
  location: package net.minecraft.block

ERROR in   src/main/java/com/example/texturepaint/entity/NpcEntity.java at line 8: package net.minecraft.entity.ai.attributes does not exist
  import net.minecraft.entity.ai.attributes.ClampedEntityAttribute;
                                           ^


=== COMPILATION ERROR ANALYSIS ===

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

FILES TO INVESTIGATE:
  - src/main/java/com/example/texturepaint/entity/NpcEntity.java
  - src/main/java/com/example/texturepaint/ModBlocks.java
  -   src/main/java/com/example/texturepaint/ModBlocks.java
  -   src/main/java/com/example/texturepaint/entity/NpcEntity.java

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

Kodari AI
KodariApr 18 at 10:35 am 6,305 (v2)

Two simple fixes:

  • BlockSoundGroup lives in net.minecraft.sound, not net.minecraft.block

  • ClampedEntityAttribute is a Mojmap class that doesn’t exist in Yarn — and it’s unused, so just remove the import

Both files patched — BlockSoundGroup import corrected to net.minecraft.sound and the unused Mojmap ClampedEntityAttribute import removed from NpcEntity.

kintil555

Don't forget that NPCs can install skins, either local or using nicknames.

📎 1 file 2,735 chars
📄
pasted-code-1776508588511.txt
txt 53 lines
▶
Compilation failed with 6 error(s):

ERROR in src/main/java/com/example/texturepaint/block/TexturedBlockEntity.java at line 30: cannot find symbol
            world.updateListeners(getPos(), getCachedState(), getCachedState(), Block.NOTIFY_LISTENERS);
                                                                                ^
  symbol: variable Block
  location: class TexturedBlockEntity

ERROR in src/main/java/com/example/texturepaint/ModBlockEntities.java at line 17: cannot find symbol
            BlockEntityType.Builder.create(TexturedBlockEntity::new, ModBlocks.TEXTURED_BLOCK).build()
                           ^
  symbol: variable Builder
  location: class BlockEntityType

ERROR in src/main/java/client/java/com/example/texturepaint/render/TexturedBlockEntityRenderer.java at line 31: cannot find symbol
        BlockState sourceState = Registries.BLOCK.getOrEmpty(id)
                                                 ^
  symbol: method getOrEmpty(Identifier)
  location: variable BLOCK of type DefaultedRegistry

ERROR in   src/main/java/com/example/texturepaint/block/TexturedBlockEntity.java at line 30: cannot find symbol
              world.updateListeners(getPos(), getCachedState(), getCachedState(), Block.NOTIFY_LISTENERS);
                                                                                  ^
  symbol: variable Block
  location: class TexturedBlockEntity

ERROR in   src/main/java/com/example/texturepaint/ModBlockEntities.java at line 17: cannot find symbol
              BlockEntityType.Builder.create(TexturedBlockEntity::new, ModBlocks.TEXTURED_BLOCK).build()
                             ^
  symbol: variable Builder
  location: class BlockEntityType

ERROR in   src/main/java/client/java/com/example/texturepaint/render/TexturedBlockEntityRenderer.java at line 31: cannot find symbol
          BlockState sourceState = Registries.BLOCK.getOrEmpty(id)
                                                   ^
  symbol: method getOrEmpty(Identifier)
  location: variable BLOCK of type DefaultedRegistry


=== COMPILATION ERROR ANALYSIS ===

MISSING METHODS:
  - getOrEmpty(Identifier)
ACTION: Check method names and signatures

FILES TO INVESTIGATE:
  - src/main/java/com/example/texturepaint/block/TexturedBlockEntity.java
  - src/main/java/com/example/texturepaint/ModBlockEntities.java
  - src/main/java/client/java/com/example/texturepaint/render/TexturedBlockEntityRenderer.java
  -   src/main/java/com/example/texturepaint/block/TexturedBlockEntity.java
  -   src/main/java/com/example/texturepaint/ModBlockEntities.java
  -   src/main/java/client/java/com/example/texturepaint/render/TexturedBlockEntityRenderer.java
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
34 1,279
src/client/java/com/example/texturepaint/TexturePainterModClient.java
package com.example.texturepaint;

import com.example.texturepaint.network.OpenNpcScreenPayload;
import com.example.texturepaint.network.UpdateNpcPosePayload;
import com.example.texturepaint.network.UpdateTexturePayload;
import com.example.texturepaint.render.NpcEntityModel;
import com.example.texturepaint.render.NpcEntityRenderer;
import com.example.texturepaint.render.TexturedBlockEntityRenderer;
import com.example.texturepaint.screen.NpcPoseScreen;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;

public class TexturePainterModClient implements ClientModInitializer {

    @Override
    public void onInitializeClient() {
        BlockEntityRendererFactories.register(
            ModBlockEntities.TEXTURED_BLOCK_ENTITY,
            TexturedBlockEntityRenderer::new
        );

        EntityModelLayerRegistry.registerModelLayer(NpcEntityModel.LAYER, NpcEntityModel::getTexturedModelData);

        EntityRendererRegistry.register(ModEntities.NPC, NpcEntityRenderer::new);

        ClientPlayNetworking.registerGlobalReceiver(OpenNpcScreenPayload.ID, (payload, context) -> {
            MinecraftClient client = MinecraftClient.getInstance();
            client.execute(() -> client.setScreen(new NpcPoseScreen(
                payload.entityId(),
                payload.leftArmPitch(),
                payload.rightArmPitch(),
                payload.headPitch(),
                payload.headYaw()
            )));
        });
    }
}