![Immersive Armors [Fabric/Forge]](https://media.forgecdn.net/avatars/thumbnails/494/546/256/256/637806302373612811.png)
KubeJS Compability
LTCatt opened this issue ยท 6 comments
I'm trying to add new attributes to armor using KubeJS. The modification code below works for both minecraft and other armor mods, only ImmersiveArmors' attributes can't be modified, neither to add nor to remove them.
Version:
Forge 1.20.1, ImmersiveArmors 1.6.1, KubeJS 2001.2.5-build.2
Reproduction:
Put the following script into kubejs/startup_scripts/armor.js
, restart minecraft, and then you can notice that the attributes of the iron helmet are modified, but the bone helmet's not.
ItemEvents.modification(event => {
let clearAttributes = item => {
['minecraft:generic.armor', 'minecraft:generic.armor_toughness', 'minecraft:generic.knockback_resistance', 'minecraft:generic.movement_speed'].forEach(name => {
item.getAttributes(name).forEach(attr => { item.removeAttribute(name, attr.id) });
});
}
event.modify("minecraft:iron_helmet", item => { clearAttributes(item);
item.addAttribute("forge:entity_reach", "21673239-6017-5830-0699-800000000001", "21673239-6017-5830-0699-800000000001", 1, "ADDITION");
});
event.modify("immersive_armors:bone_helmet", item => { clearAttributes(item);
item.addAttribute("forge:entity_reach", "21673239-6017-5830-0699-800000000000", "21673239-6017-5830-0699-800000000000", 1, "ADDITION");
});
})
I understand that the mod's config allows editing of attributes, but I can't add NEW attributes to the armor. If you don't want to fix this, maybe adding a config that allows the modpack author to add new attributes to the armor would work as well :D
Have you found a solution?
I want to add additional movement speed when wearing armor from the mod. Can you give me any advice?
There's no good solution.
You could only create a new armor and use its textures :/
I'm not entirely sure why it doesn't work or where KubeJS applies the attributes exactly. The only place where I mess with attributes is getAttributeModifiers
and I think that is the intended way.
This is probably because applyItemOverwrite
call occurs after KubeJS's ItemEvents.modification
, causing properties that have already been modified by KubeJS to be cleared