
Show Icon for effect?
drkhodakarami opened this issue ยท 3 comments
Hi
When I use this code :
source.grantTo(player, VanillaAbilities.ALLOW_FLYING);
How can I show the flight effect icon? I have an icon in textures/mob_effect/
This texture has the same name as the identifier used for registering the effect but when I equip the item and get the ability to flight, the icon is not showing. How can I show the icon when granting the effect?
Did you actually make a mob effect for this ? Because PAL does not display anything by itself.
Did you actually make a mob effect for this ? Because PAL does not display anything by itself.
Thanks for the fast reply. I solved the issue. It would be nice to have this in some example available for future:
1- I created the FlightEffect class as provided in the example mod
2- I created the StatusEffect in the ModEffects as RegistryEntry but didn't initialize it inline.
3- I register the effect in the register method of ModEffects using Registry.registerReference (not Registery.register)
3- I used the ServerEntityEvents.EQUIPMENT_CHANGE
4- In the event subscription, now I simply create a new StatusEffectInstance and assign or remove the effect as needed.
it works without a problem. The key difference compared to the provided mod example is the usage of RegistryEntry and using the registerReference here.