Virtuoel / Pehkui

Fabric/Forge/NeoForge/Quilt mod that allows for changing the size of any entity.
MIT License
87 stars 34 forks source link

[Suggestion]: Add the ability to use modifiers without them persisting. #464

Open MerchantPug opened 8 months ago

MerchantPug commented 8 months ago

What is your suggestion?

Unfortunately, I think this would require a rewrite to the modifier system you already have, but, I would love for the ability to have non persistent modifiers, in that they wouldn't require a registry value, and that they wouldn't require saving to the player.

This is for use cases where the modifiers are handled elsewhere (for my example, an Origins power).

sisby-folk commented 7 months ago

Speaking more generally, I think it'd be nice to have this fulfilled via an attribute modifier system for scales - as in, command-with-a-uuid, type, and value kind of thing - same as vanilla. This would give the most leeway to datapackers interacting with scale temporarily in all ways.

MerchantPug commented 7 months ago

Speaking more generally, I think it'd be nice to have this fulfilled via an attribute modifier system for scales - as in, command-with-a-uuid, type, and value kind of thing - same as vanilla. This would give the most leeway to datapackers interacting with scale temporarily in all ways.

I feel like we should have both, mainly because developers might want to have different styles of modifiers (in my case Apoli has a separate modifier system that has more options than vanilla's modifiers). Giving datapackers the ability to use attribute modifiers for Pehkui scales as modifiers would be neat though.

MerchantPug commented 7 months ago

Although for a more generalised use case, attribute modifiers work perfectly.

MerchantPug commented 7 months ago

I'll link certain classes used for Apugli's Modify Scale power type just in case you'd like to see what I'd like out of such a system.

https://github.com/MerchantPug/apugli/blob/1.20.2/common/src/main/java/net/merchantpug/apugli/integration/pehkui/ApoliScaleModifier.java https://github.com/MerchantPug/apugli/blob/1.20.2/common/src/main/java/net/merchantpug/apugli/integration/pehkui/LerpedApoliScaleModifier.java

https://github.com/MerchantPug/apugli/blob/1.20.2/fabric/src/main/java/net/merchantpug/apugli/mixin/fabric/integration/pehkui/ScaleDataMixin.java

MerchantPug commented 7 months ago

Speaking more generally, I think it'd be nice to have this fulfilled via an attribute modifier system for scales - as in, command-with-a-uuid, type, and value kind of thing - same as vanilla. This would give the most leeway to datapackers interacting with scale temporarily in all ways.

I feel like we should have both, mainly because developers might want to have different styles of modifiers (in my case Apoli has a separate modifier system that has more options than vanilla's modifiers). Giving datapackers the ability to use attribute modifiers for Pehkui scales as modifiers would be neat though.

To elaborate, how I could see this structured.

Is that AttributeScaleModifier is a subclass of a basic ScaleModifier. Using a command, you can add an AttributeScaleModifier. Then ScaleModifiers are rewritten/partially rewritten to allow for determining whether they save to an entity or not. (Maybe through toTag and fromTag methods inside the ScaleModifier class?). Attribute Modifiers would, but externally handled things probably wouldn't want to be saved.