Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add primitive value catching and implement suppliers #9947

Open
wants to merge 2 commits into
base: 1.20.x
Choose a base branch
from

Conversation

SrRapero720
Copy link
Contributor

sadly not all types had its own supplier to get the primitive value, for those cases i add a "wanna be" method using the same name format of the java suppliers and also extensing from supplier returned the boxed value.

@autoforge autoforge bot added Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. 1.20 labels May 1, 2024
@autoforge autoforge bot requested a review from a team May 1, 2024 10:01
@PaintNinja
Copy link
Contributor

PaintNinja commented May 1, 2024

I don't think you're handling cache invalidation properly for the primitive values. Sure, the inherited set() method changes the value field, but it doesn't set it to null, which is what the primitive getters are checking for updating the primitive backing value field.

BooleanValue thing = builder.define("thing", true);
System.out.println(thing.getAsBoolean()); // true
thing.set(false);
System.out.println(thing.getAsBoolean()); // still true, should be false

@PaintNinja PaintNinja added Feature This request implements a new feature. Work In Progress This request has lots of changes that need attention. labels May 1, 2024
@Jonathing
Copy link
Member

What is the problem with boxed primitives in configs? It's not like this is rendering code.

@SrRapero720
Copy link
Contributor Author

no, but can be used on rendering code...
normally modders makes a hell'ish config class just to cache the values instead of supply that directly on the configvalues

@SrRapero720
Copy link
Contributor Author

I don't think you're handling cache invalidation properly for the primitive values. Sure, the inherited set() method changes the value field, but it doesn't set it to null, which is what the primitive getters are checking for updating the primitive backing value field.

yep, i notice it after clean up the cherrypick from #9814. fixing it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20 Feature This request implements a new feature. Triage This request requires the active attention of the Triage Team. Requires labelling or reviews. Work In Progress This request has lots of changes that need attention.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants