Jump to content

(1.17.1) Problems when generating an armor model with color change.


Recommended Posts

Posted

I made an armor which I want to change color, but when adding the texture, the texture in the game is bugged, not as if there is no texture, and obviously it does not change color, I think it is a problem with the .mcmeta files for animated textures, since if I change the texture to a normal one without animation then it works fine within the game.

 

The .mcmeta files:

{
  "animation": {
    "frametime": 1,
    "interpolate": false,
    "frames": [
      0,
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10
    ]
  }
}

 

Posted

Just in case, the configuration files:

 

The ExampleArmorTiers:

public enum ExampleArmorMaterials implements ArmorMaterial {
    EXAMPLE("example", 200, new int[]{4, 7, 9, 4}, 30, SoundEvents.ARMOR_EQUIP_DIAMOND, 4.0F, 0.2F, () -> {
        return Ingredient.of(new ItemLike[]{(ItemLike) ExampleItems.EXAMPLE_GEM.get()});
    });

    private static final int[] baseDurability = new int[]{13, 15, 16, 11};
    private final String name;
    private final int durabilityMultiplier;
    private final int[] slotProtections;
    private final int enchantmentValue;
    private final SoundEvent sound;
    private final float toughness;
    private final float knockBackResistance;
    private final Ingredient repairIngredient;

    private ExampleArmorMaterials(String name, int durabilityMultiplier, int[] defenseForSlot, int enchantmentValue, SoundEvent equipSound, float toughness, float knockBackResistance, Supplier<Ingredient> repairIngredient) {
        this.name = name;
        this.durabilityMultiplier = durabilityMultiplier;
        this.slotProtections = defenseForSlot;
        this.enchantmentValue = enchantmentValue;
        this.sound = equipSound;
        this.toughness = toughness;
        this.knockBackResistance = knockBackResistance;
        this.repairIngredient = (Ingredient) repairIngredient.get();
    }

    public int getDurabilityForSlot(EquipmentSlot slot) {
        return baseDurability[slot.getIndex()] * this.durabilityMultiplier;
    }

    public int getDefenseForSlot(EquipmentSlot slot) {
        return this.slotProtections[slot.getIndex()];
    }

    public int getEnchantmentValue() {
        return this.enchantmentValue;
    }

    public SoundEvent getEquipSound() {
        return this.sound;
    }

    public Ingredient getRepairIngredient() {
        return this.repairIngredient;
    }

    public String getName() {
        return ExampleMod.modid + ":" + this.name;
    }

    public float getToughness() {
        return this.toughness;
    }

    public float getKnockbackResistance() {
        return this.knockBackResistance;
    }
}

 

 

And the ExampleItems:

public class ExampleItems {
    public static final DeferredRegister<Item> ITEMS;

    public static final RegistryObject<Item> EXAMPLE_DUST;
    public static final RegistryObject<Item> EXAMPLE_GEM;
    public static final RegistryObject<Item> EXAMPLE_ORE;
    public static final RegistryObject<ArmorItem> EXAMPLE_HELMET;
    public static final RegistryObject<ArmorItem> EXAMPLE_CHESTPLATE;
    public static final RegistryObject<ArmorItem> EXAMPLE_LEGGINGS;
    public static final RegistryObject<ArmorItem> EXAMPLE_BOOTS;
    public static final RegistryObject<AxeItem> EXAMPLE_AXE;
    public static final RegistryObject<HoeItem> EXAMPLE_HOE;
    public static final RegistryObject<PickaxeItem> EXAMPLE_PICKAXE;
    public static final RegistryObject<ShovelItem> EXAMPLE_SHOVEL;
    public static final RegistryObject<SwordItem> EXAMPLE_SWORD;

    static {
        ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "examplemod");

        EXAMPLE_DUST = ITEMS.register("example_dust", () -> {
            return new Item((new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_GEM = ITEMS.register("example_gem", () -> {
            return new Item((new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_ORE = ITEMS.register("example_ore", () -> {
            return new BlockItem((Block) ExampleBlocks.EXAMPLE_ORE.get(), (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_HELMET = ITEMS.register("example_helmet", () -> {
            return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.HEAD, (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_CHESTPLATE = ITEMS.register("example_chestplate", () -> {
            return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.CHEST, (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_LEGGINGS = ITEMS.register("example_leggings", () -> {
            return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.LEGS, (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_BOOTS = ITEMS.register("example_boots", () -> {
            return new ArmorItem(ExampleArmorMaterials.EXAMPLE, EquipmentSlot.FEET, (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_AXE = ITEMS.register("example_axe", () -> {
            return new AxeItem(ExampleTiers.EXAMPLE_TOOL, 5.0F, -3.0F, (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_HOE = ITEMS.register("example_hoe", () -> {
            return new HoeItem(ExampleTiers.EXAMPLE_TOOL, -5, 0.0F, (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_PICKAXE = ITEMS.register("example_pickaxe", () -> {
            return new PickaxeItem(ExampleTiers.EXAMPLE_TOOL, 1, -2.8F, (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_SHOVEL = ITEMS.register("example_shovel", () -> {
            return new ShovelItem(ExampleTiers.EXAMPLE_TOOL, 1.5F, -3.0F, (new Properties()).tab(ExampleMod.examplemod));
        });
        EXAMPLE_SWORD = ITEMS.register("example_sword", () -> {
            return new SwordItem(ExampleTiers.EXAMPLE_TOOL, 3, -2.4F, (new Properties()).tab(ExampleMod.examplemod));
        });
    }
}

 

Posted
6 hours ago, poopoodice said:

From my experience it just does not work on armours.

But I remember some mods, which added that type of textures, I think I'll look inside their files, to see how they do it ...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.