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 transitive access wideners for display entity tracked data fields #4229

Open
wants to merge 4 commits into
base: 1.21.3
Choose a base branch
from

Conversation

andantet
Copy link

It seems desirable to have access to the tracked data fields of display entity classes.

Developers will have the option to call Entity.dataTracker methods with these TrackedData fields.

(I have not been able to find any other way to get/set the data values of these entities, however if there is a simpler way then I would love to know.)

As an alternative, it would be nice to have access to the getter/setter methods within the display entity classes, but I couldn't think of a clean generative way to achieve this.

Copy link
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is exposing the fields the best way to go? It looks like there are getters and setters for most if all of these pieces of data. I think it would be better to TAW those.

fabric-transitive-access-wideners-v1/build.gradle Outdated Show resolved Hide resolved
@andantet
Copy link
Author

I've hacked together a solution which checks for dataTracker accesses within get/set methods

  1. Is getter/setter
  2. If getter, has no parameters
  3. If setter, has 1 parameter
  4. Is private, is not static
  5. Contains dataTracker field reference as get

Copy link
Member

@modmuss50 modmuss50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea!

fabric-transitive-access-wideners-v1/build.gradle Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants