
[KJS7]The attribute effects granted by mob_effect require multiple applications to activate.
ValueBackingDown opened this issue · 0 comments
Minecraft Version
1.21.1
KubeJS Version
2101.7.1-build.181
Rhino Version
2101.2.7-build.74
Architectury Version
No install
Forge/Fabric Version
NeoForge 21.1.141
Describe your issue
### This bug reproduces every time the game is restarted, and I have not yet found a solution.
1.Register a mob_effect_register.js in the startup_scripts folder. In this case, I am using an effect that adds armor value.
2.Use the /effect give command to apply this effect.
3.Check your armor value with /attribute @s minecraft:generic.armor get. If the value remains 0 during the effect's duration, it means the effect is not working. Reapply the effect to yourself and check the armor value again to confirm it takes effect.
Code mob_effect_register.js:
StartupEvents.registry('mob_effect',event=> {
event.create('iron_skin')
.beneficial()
.color('#d1bcad')
.modifyAttribute('minecraft:generic.armor','kubejs:iron_skin',8,'add_value')
})
Code registry potion_bottle
let $MobEffectInstance = Java.loadClass('net.minecraft.world.effect.MobEffectInstance')
StartupEvents.registry('potion',event => {
event.create('iron_skin')
.addEffect(new $MobEffectInstance('kubejs:iron_skin',3600,0))
})
PS:This bug can also be identified by observing the tooltips. If the corresponding potion bottle does not display "When Applied: [Attribute]", it means the modification to the armor value has not taken effect.
https://github.com/user-attachments/assets/949005c4-3e96-4183-a215-9788aa6414d5
Crash report/logs
No response