Configurable Modifiers
Kovak opened this issue ยท 11 comments
I noticed you have a note for yourself in the code, but it would be really nice to switch away from the current EnumBaubleModifier to a real registry
Current progress on this: the bauble modifier registry is implemented in modifier_registry, however it won't work for any non-attribute modifier effects, due to the hacky workaround that is currently used to apply modifiers - every 10 ticks, every single possible modifier is removed, then modifiers on the baubles players are wearing are reapplied. This is obviously far from ideal, and calling every single removeModifier
method would be even worse.
The reason I did this originally was due to the lack of events for bauble equips/unequips. I've asked for events in Azanor/Baubles#273, but haven't gotten any response yet.
If events don't get implemented in Baubles, these are the possible ways I see of dealing with equipping/unequipping:
- Call every single
removeModifier
method everyn
ticks, then reapply active modifiers. Not good. - Store a list of player's currently equipped items somewhere, then every
n
ticks check if baubles have changed, and if so call the respectiveremoveModifier
andapplyModifier
methods. This solution seems the most viable, although it might be prone to issues on death or leave/rejoin. - Use ASM to add events to baubles. I have no experience with ASM, and this seems like a bad idea, but it could work?
Also interesting to note that Quality Tools also implements bauble modifiers. Might be a good idea to investigate how it handles it, although it doesn't seem to be open source.
Just sent a PR to add an event modeled after LivingEquipmentChangeEvent for you:
Hopefully they will be receptive.
Looks like the Baubles PR is never going to be accepted, however Modifiers, the 1.14 version of this system for curios, does use the modifier registry.
Curios is basically the equivalent of Baubles for 1.14, except with a bunch of nicer features and a significantly more responsive developer. BountifulBaubles and Modifiers both use Curios instead of Baubles on 1.14. (Splitting Modifiers into its own mod was an unrelated decision to this, I just figured that doing so would allow me to expand on its features eventually.)
Oh that's awesome. I'll be moving my development over to 1.14 pretty soon and will definitely be adding an integration for MK Ultra attributes on your modifiers.
You might want to hold off on doing that just a bit, because I'll probably be refactoring how modifiers work - will probably have a registry for modifier effects, and have data pack-defined modifiers with 1 or more effects from those registered effects. That way it's configurable by non-modders but also extensible by modders.