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

BlockProperty API #11963

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Machine-Maker
Copy link
Member

@Machine-Maker Machine-Maker commented Jan 12, 2025

Replaces #7223


My take on how to add a "get block data properties individually" on top of bukkit's existing method-based system.

Structure

3 types of data properties: Boolean, Integer, and Enum. This pr creates a base BlockProperty class with 3 (+ special cases) implementations of it for each type.

Special Cases

So far, I've noticed 2 API types that are used to wrap integers, so this also adds handling for those, not exposing them as integers.

  • rotation as BlockFace
  • note as Note

The BlockPropertyHolder interface contains all the methods to interact with a set of properties. I left it as a standalone interface in case other uses in the future popup where a separate impl might be warranted. I added a Mutable subinterface to that to separate out the "set" methods, some implementations of it might not want to support mutating properties (such as future FluidState API #8609).

Tests

I wrote some significant tests to ensure all nms Propertys from BlockStateProperties have a counterpart, and they are equal to each other.

@Machine-Maker Machine-Maker requested a review from a team as a code owner January 12, 2025 22:44
@kennytv kennytv added the type: feature Request for a new Feature. label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: api type: feature Request for a new Feature.
Projects
Status: Awaiting review
Development

Successfully merging this pull request may close these issues.

3 participants