`setFoodProperties` cannot remove level 2 effects from food items
saltyseadoggo opened this issue ยท 0 comments
Minecraft Version
1.18.2
KubeJS Version
1802.5.4-build.533
Rhino Version
1802.1.14-build.209
Architectury Version
4.8.81
Forge/Fabric Version
Forge 40.1.73
Describe your issue
When I try to remove a level 2 status effect from a food using setFoodProperties
in a startup script, the script will load and do everything else in it, but it won't remove the effect.
Steps to reproduce:
- Make a new Minecraft installation with the above versions of Forge, KubeJS and its dependencies, as well as this version of Twilight Delight. https://www.curseforge.com/minecraft/mc-mods/twilight-delight/files/3866361
- Place this code into a startup script in the startup scripts folder:
onEvent('item.modification', event => { event.modify("twilightdelight:lily_chicken", (item) => { item.setFoodProperties((food) => { food.alwaysEdible(true); food.removeEffect("minecraft:fire_resistance"); }); }) })
- Start the game and enter a world.
- Obtain some
twilightdelight:lily_chicken
, the item from the above script. This food item applies Fire Resistance II, which the script should remove. - Enter survival mode and eat a lily chicken plate with your hunger bar full to verify that the
alwaysEdible
modification worked, and that, thus, the script isn't malformed. - Eat the lily chicken. Observe how you are given fire resistance II in spite of the script.
- Exit the game.
- Compile Twilight Delight from my fork here: https://github.com/saltyseadoggo/Twilight-Delight. This fork changes the Fire Resistance effect given by the lily chicken to level 1 instead of 2.
- Replace the Twilight Delight .jar in your mods folder with the one you compiled from my fork.
- Start the game again, enter a world, and run
/effect clear @e
if you still have effects. - Eat a lily chicken plate. Observe that you were not given fire resistance, and that, thus, the script removed it successfully.
Crash report/logs
No response