-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
BlockProperty API #7223
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 #7223
Conversation
I do not like the name |
I guess because there is already |
That's nice, but not a reasonable reason. |
No reason as the Damagable exists two times as well. For ItemMeta and the Entities. I'm happy that such API get introduced into Paper-API. First steps to be able to handle custom block data in future. |
What does the name “DataProperty” have to do with limiting it to blocks? Or limiting its expansion to other things. Nms calls them Property, and creates them all in a class called BlockStateProperties. They are properties for block/fluid states. And the closest Bukkit representation of that, is BlockData, which is used for both blocks and fluids. I think DataProperty makes sense in that context. On a much smaller improvement scale, it’s also different from the nms name for it, which makes imports just nicer. |
a215c41
to
648e895
Compare
648e895
to
d43953b
Compare
Ok, renamed to
|
5b4edb1
to
7be3d7c
Compare
7be3d7c
to
1e2fc83
Compare
1e2fc83
to
17c5174
Compare
Rebased for 1.18.2 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
17c5174
to
af3a1de
Compare
Rebased for 1.19.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking over this, this looks fine
af3a1de
to
b4294ee
Compare
b4294ee
to
69ee884
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As specified before, we probably want to rename this to BlockProperty or something.
The propertyholder/etc classes however I'm not sure about, because that may be useful API to have shared with items/blocks/etc. Unsure tho. The item property PR however creates a very similar property holder class and such.
I'd also maybe mark the block properties for stuff like chiseled bookshelf as experimental.
Looks good tho, really nice powerful api! 😄
I disagree, that would limit its use for other things in the future. |
Then we may need to see about aligning this property API in a way that makes it work with the item property api too then? |
69ee884
to
5c836b3
Compare
5c836b3
to
567ca84
Compare
567ca84
to
4e88f48
Compare
4e88f48
to
dba19bd
Compare
75bf092
to
c2a3487
Compare
c2a3487
to
22ff9c4
Compare
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
, andEnum
. This pr creates a baseBlockProperty
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 BlockFacenote
as NoteThe
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 aMutable
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
Property
s fromBlockStateProperties
have a counterpart, and they are equal to each other.