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

MaterialTag.half,faces,distance Property Modernization #2660

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

heypr
Copy link
Contributor

@heypr heypr commented Oct 31, 2024

  • Modernized MaterialTag.half property.
  • Modernized MaterialTag.faces property.
  • Modernized MaterialTag.distance property.

@heypr heypr marked this pull request as draft October 31, 2024 23:40
@heypr heypr marked this pull request as ready for review December 23, 2024 00:03
@mcmonkey4eva mcmonkey4eva changed the title Modernized Properties Part 6 MaterialTag.half,faces,distance Property Modernization Dec 23, 2024
Comment on lines +88 to +94
public static MaterialDistance getFrom(MaterialTag _material) {
if (!describes(_material)) {
return null;
}
else {
return new MaterialDistance(_material);
}
Copy link
Member

Choose a reason for hiding this comment

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

There's shouldn't be any need to keep getFrom - if anything is using this property directly, can use describes & add a constructor that directs to super.
In general should ideally remove the older methods when updating a property, any is/getX methods can just be instanceof pattern matching, any get/setDistance sorta methods can usually just be put directly in get/setPropertyValue, etc..
It's not an absolute requirement, but it'd be nicer to have the properties fully match the modern format.

return new MaterialDistance((MaterialTag) _material);
}
}
MaterialTag material;
Copy link
Member

Choose a reason for hiding this comment

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

Should remove the old field and use the built-in object field.

Copy link
Member

Choose a reason for hiding this comment

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

And with that, should use the MaterialProperty methods (e.g. getBlockData() instead of material.getModernData())

// For "Bisected" blocks (doors/double plants/...), values are either "BOTTOM" or "TOP".
// For beds, values are either "HEAD" or "FOOT".
// For chests, values are either "LEFT" or "RIGHT".
// For the half name, see <@link tag MaterialTag.half>.
Copy link
Member

Choose a reason for hiding this comment

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

Isn't that just linking to itself? should already automatically be in the mechanism's tag link

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.

3 participants