Armor NBT tag not working
Genqar opened this issue ยท 6 comments
Does the armor from the {backpack:{armor:x}} tag show in the UI like normal armor would? (Such as the shields showing amount of armor) or at least display on the item itself that it gives like +x armor when worn on chest or something?
I tried to spawn a backpack in with armor and had no luck. Help would be appreciated.
Example commands:
/give @p wearablebackpacks:backpack 1 0 {backpack:{armor:6}}
/give @p wearablebackpacks:backpack 1 0 {backpack:{size:[6,3], armor:6}}
The size tag portion works fine in this, but I'm unsure if I am using the armor portion incorrectly.
(Using build Wearable Backpacks - 1.12.2 - 3.1.0 and forge-14.23.1.2561
Oh. I suppose the backpacks don't have any of that information in the tooltip. (They probably should.) When worn in the chestplate slot it should raise the displayed armor value above the health bar. Backpacks aren't actually armor items, but they do implement an interface ISpecialArmor
that emulates Vanilla behavior.
Let me know if it's still not working properly, and I'll have a look at it as soon as I can.
Even in the config, having I:armor=2 makes default backpacks still not give any armor points (visually at least) for me.
For the time being I am using the generic attribute modifier
/give @p wearablebackpacks:backpack 1 0 {backpack:{size:[6,3]},AttributeModifiers:[{Slot:"chest",AttributeName:"generic.armor",Name:"generic.armor",Amount:5,Operation:0,UUIDLeast:894654,UUIDMost:2872}]}
Posting example in case other people are having the same issue.
I appreciate it. In the meantime, at least there is a work-around!
Thanks for all the hard work on a really refreshing take on the backpack mods.
I'm unsure as to why the armor wasn't showing up, but now I've changed my code to use attribute modifiers itself, so just supplying the backpack:{armor:x}}
NBT tag allows you to set the armor - meaning you don't have to use the unwieldy attribute stuff.
Unfortunately I had to roll back these changes in 89b8f3f because backpacks did not take damage anymore. Thanks to the mess that is Minecraft modding, I can't use both ISpecialArmor
and attribute modifiers together. The former is required for a backpack API method to be called when the backpack does break and there's no alternative. Additionally, if the item isn't an ItemArmor
, it won't be damaged with just the modifiers.
The displayed armor bars should be displayed, and damage should be properly absorbed, but the item tooltip will not show how much armor a backpack provides.