Jump to content

Armor Capability


honn3x

Recommended Posts

I would like to add a "Capability" to my armor and that at each "level" it changes the texture of the armor

In practice:

I created a custom armor, I wanted it to have a Capability of "Magic Power" and "Magic Resistance"

And I wanted its texture to change as this capability changed, something like:

if (armor.MagicPower == 1) {
show "armor.textureMagicPower1"
}
if (armor.MagicPower == 2) {
show "armor.textureMagicPower2"
}

if (armor.MagicPower == 2 && armor.MagicResistance == 1) {
show "armor.textureMagicPower2MagicResistance1"
}

How can I do this?

Link to comment
Share on other sites

I already did a "ModItemProperties" class
 

Quote

public class ModItemProperties {
public static void addCustomItemProperties() {
makeArmor(ModItens.MAGIC_ARMOR.get());
}

private static void makeArmor(Item item) {
ItemProperties.register(item, new ResourceLocation("magicresistancelevel"), (s1, s2, s3, s4) -> {
return s3 != null && s3.isUsingItem() && s3.getUseItem() == s1 ? 1.0F : 0.0F;
});
ItemProperties.register(item, new ResourceLocation("magicpowerlevel"), (s1, s2, s3, s4) -> {
return s3 != null && s3.isUsingItem() && s3.getUseItem() == s1 ? 1.0F : 0.0F;
});
}
}

But I need to know how to change texture and change magicpowerlevel...

Basically, I'm using a super improvised system at the moment, so what I want is that:

When the player's thirst reaches the maximum it returns to "0" and adds 1 in "magicpowerlevel" of the armor, and every 1 level, the texture of the armor changes...

P.s. I Already did the system to whente player's thirst reachs the maximum it return to "0", I only need to know how to add 1 to "magicpowerlevel"

I believe that the main json file should look something like:

 

Quote

.........
},
"textures": {
"layer0": "tutorialmod:item/magicarmor"
},
"overrides": [
{
"predicate": {
"minecraft:magicpowerlevel": 1,
"minecraft:magicresistancelevel": 0
},
"model": "tutorialmod:item/magicarmor_magicpowerlevel_1"
},
{
"predicate": {
"minecraft:magicpowerlevel": 2,
"minecraft:magicresistancelevel": 0
},
"model": "tutorialmod:item/magicarmor_magicpowerlevel_2"
},
{
"predicate": {
"minecraft:magicpowerlevel": 3,
"minecraft:magicresistancelevel": 1
},
"model": "tutorialmod:item/magicarmor_magicpowerlevel_3_magicresistancelevel_1"
}
]
}

 

Edited by honn3x
adding more content
Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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