Help Understanding how to do modifers code-wise
Minenash opened this issue ยท 0 comments
As a part of the mod I'm currently working on, the player can scale themselves by -25% to 25%. As I want to support origins, I can't just set the scale, as that would override their scale. Looking through the code, I found ScaleModifier
s, but I can't for the life of me get it to work.
This is what I have for the modifier itself:
public static final ScaleModifier testModifier = ScaleRegistries.register(
ScaleRegistries.SCALE_MODIFIERS,
PersonalityMod.id("test"),
new TypedScaleModifier(() -> ScaleTypes.BASE, (modifiedScale,scale) -> modifiedScale * 5)
);
And this is what I'm trying to do to add it:
ScaleTypes.BASE.getScaleData(player).getBaseValueModifiers().add(testModifier);
According to a print statement above it, the modifier set definitely includes the scale modifier, but it doesn't seem to be doing anything. I tried also doing ScaleData.markForSync(true)
and ScaleData.onUpdate()
to no affect.