Adan Aramburo

crea un mod de forge 1.20.1 en donde puedas crear armaduras personalizables, el sistema de personalización de la armadura funcionará en una mesa especial en donde se te abrirá una interfaz en donde tendrás un editor parecido como si fueras a crear una skin de minecraft, en donde tendrás distintos pincheles con diferentes colores. Al terminar de editar la armadura al ponertela tendrá esa textura que tú escojiste. este sistema tendrá la opción de casco, peto, pantalones y botas

Kodari AI
KodariOct 6 at 5:21 am 1
ArmorCraftStudio
ArmorCraftStudio is a Forge 1.20.1 mod that introduces a specialized crafting table where players can design fully customizable armor textures. The interface features a skin-style editor with various paint brushes and a color palette, allowing pixel-by-pixel customization. Once the design is complete, the armor piece (helmet, chestplate, leggings, or boots) adopts the custom texture when equipped. The mod supports all four armor slots, enabling complete personalized armor sets with unique visual appearances.

Hay un conflicto de versiones: el entorno de este proyecto dispone de fuentes para Fabric 1.20.4, pero pediste un mod para Forge 1.20.1. No puedo verificar ni garantizar una implementación Forge correcta con las fuentes disponibles.

¿Prefieres que lo cree para Fabric 1.20.4 o mantenemos Forge 1.20.1?

Adan Aramburo

forge 1.20.1

Kodari AI
KodariOct 6 at 5:22 am 1

Entendido: Forge 1.20.1. Este proyecto solo tiene disponibles las fuentes de Fabric 1.20.4, así que no puedo crear ni verificar aquí una implementación Forge correcta. Para seguir, cambia el proyecto a un entorno con soporte y fuentes de Forge 1.20.1; o dime si aceptas que lo adapte a Fabric 1.20.4.

Adan Aramburo

entonces hazlo fabric 1.20.4

Kodari AI
KodariOct 6 at 5:56 am 15
  1. Prepararé la base del mod Fabric 1.20.4, la mesa y las cuatro piezas de armadura con recetas.

  2. Añadiré un editor de píxeles con paleta, herramientas y guardado del diseño en cada pieza.

  3. Haré que la textura personalizada se aplique al equipar la armadura.

Creé el mod Armor Craft Studio para Fabric 1.20.4. La mesa abre un editor de píxeles de 64×32 con 16 colores, lápiz, pincel, relleno y borrador. Puedes guardar un diseño independiente para cada pieza; se conserva en el objeto y aparece al equiparlo.

Cómo obtenerlo en supervivencia:

  • Mesa de personalización: 8 lingotes de hierro alrededor de una mesa de crafteo.

  • Casco: 5 lingotes de hierro.

  • Peto: 8 lingotes.

  • Pantalones: 7 lingotes.

  • Botas: 4 lingotes.

La mesa y las cuatro piezas también aparecen en la pestaña de combate del inventario creativo. Las armaduras tienen estadísticas de hierro y se reparan con lingotes de hierro.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
28 723
src/main/java/com/kodari/armorcraftstudio/ArmorCraftStudioClient.java
package com.kodari.armorcraftstudio;

import java.util.Arrays;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer;
import net.fabricmc.fabric.api.event.player.UseBlockCallback;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;

public final class ArmorCraftStudioClient implements ClientModInitializer {
    private static final Map<String, Identifier> TEXTURE_CACHE = new HashMap<>();

    @Override
    public void onInitializeClient() {
        ArmorRenderer.register(this::renderArmor, ArmorCraftStudio.ARMOR_ITEMS);
        UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> {
            if (!world.getBlockState(hitResult.getBlockPos()).isOf(ArmorCraftStudio.CUSTOMIZATION_TABLE)) {
                return ActionResult.PASS;
            }
            MinecraftClient client = MinecraftClient.getInstance();
            if (client.player != null) {
                client.setScreen(new ArmorDesignScreen(hitResult.getBlockPos()));
            }
            return ActionResult.SUCCESS;
        });
    }

    private void renderArmor(net.minecraft.client.util.math.MatrixStack matrices,
                             net.minecraft.client.render.VertexConsumerProvider vertexConsumers,
                             ItemStack stack,
                             LivingEntity entity,
                             EquipmentSlot slot,
                             int light,
                             BipedEntityModel<LivingEntity> model) {
        byte[] pixels = stack.getNbt() == null
                ? new byte[0]
                : stack.getNbt().getByteArray(ArmorCraftStudio.DESIGN_KEY);
        if (pixels.length != ArmorCraftStudio.DESIGN_SIZE) {
            pixels = new byte[ArmorCraftStudio.DESIGN_SIZE];
            Arrays.fill(pixels, (byte) 0);
        }

        Identifier texture = getTexture(pixels);
        model.setVisible(false);
        switch (slot) {
            case HEAD -> {
                model.head.visible = true;
                model.hat.visible = true;
            }
            case CHEST -> {
                model.body.visible = true;
                model.leftArm.visible = true;
                model.rightArm.visible = true;
            }
            case LEGS -> {
                model.body.visible = true;
                model.leftLeg.visible = true;
                model.rightLeg.visible = true;
            }
            case FEET -> {
                model.leftLeg.visible = true;
                model.rightLeg.visible = true;
            }
            default -> {
                return;
            }
        }
        ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, model, texture);
    }

    private Identifier getTexture(byte[] pixels) {
        String cacheKey = Base64.getEncoder().encodeToString(pixels);
        return TEXTURE_CACHE.computeIfAbsent(cacheKey, key -> {
            NativeImage image = new NativeImage(NativeImage.Format.RGBA, ArmorCraftStudio.DESIGN_WIDTH, ArmorCraftStudio.DESIGN_HEIGHT, false);
            for (int i = 0; i < pixels.length; i++) {
                int paletteColor = ArmorCraftStudio.PALETTE[pixels[i] & 0xFF];
                int abgrColor = (paletteColor & 0xFF00FF00)
                        | ((paletteColor & 0x000000FF) << 16)
                        | ((paletteColor & 0x00FF0000) >>> 16);
                image.setColor(i % ArmorCraftStudio.DESIGN_WIDTH, i / ArmorCraftStudio.DESIGN_WIDTH, abgrColor);
            }
            NativeImageBackedTexture texture = new NativeImageBackedTexture(image);
            return MinecraftClient.getInstance().getTextureManager().registerDynamicTexture("armorcraftstudio_armor", texture);
        });
    }
}