-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Reworking block properties #529
Conversation
Added the following properties: Axis Open Age Attachment Signal Fire 6 connection directions
I like the changes, but i believe we may should rewrite the properties to be inside the block implementations, this would make using them in code easier, That way we can implement Redstone for example |
@Snowiiii I was planning on changing properties and blocks to allow having custom place and update functions, if you like I can start working on that rework and in some days I could have a playable version. |
That would be great, I think we should do that in this PR. I think a goal you can set is to have a lever working, You have to get the use_item event in the current block implentation and then changing the blockstate depending if it's on or off. Later we then can send block neighbor updates and have Redstone working :D |
Changed block properties to make them more extensible and easier to handle.
Update: Properties reworkNow the block properties are based on the “BlockProperty” trait, which allows better separation and more extensibility, added a proc macro to make the implementation of the properties easier and now you only need to put the necessary information. Note: All the previously implemented properties should work correctly. Next: on_interact function implementation for properties and block modifiers to "on_place" |
Made the lever work, implementing modifiers to the “on_place” per block, plus the “on_interact” function to handle the state when interacting with a block that has it.
Update: Levers works now! 🎊 🌟 🥳Made the lever work, implementing modifiers to the “on_place” per block, plus the “on_interact” function to handle the state when interacting with a block that has it. Now it remains to combine the APIs of the blocks and the properties, with respect to interactions. VideoGrabacion.de.pantalla.2025-02-09.021805.mp4 |
pub enum Powered { | ||
True, | ||
False, | ||
} |
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.
This should be a boolean, This would also match Vanilla then.
You can make a direct field
pub struct Powered(bool)
Looks awesome. Great work like always @DarkMrMelther :D. But i think we should not only use Enums. I think there should be some kinda implementation for different property types like in Vanilla, Supporting all common types like booleans, integers and enums |
@Snowiiii I think that this is the nearest aproach i can do to implement primitive types (Bool at the moment) without having to rewrite the entire system. |
Overall Great work @DarkMrMelther!. Thank you so much ❤️ always love to see a new PR from you :D |
* Added 11 blocks properties Added the following properties: Axis Open Age Attachment Signal Fire 6 connection directions * Clippy my beloved 💕 * Reworked block properties Changed block properties to make them more extensible and easier to handle. * Little too much of Clippy * Lever works!!! 🎉 Made the lever work, implementing modifiers to the “on_place” per block, plus the “on_interact” function to handle the state when interacting with a block that has it. * Kinda implemented bool as value * A little bit of Clippy :)
Description
Added the following properties:
Note: The blocks are not updated automatically, we should refactor block placement to allow update blocks properties, and custom placement functions (like for doors, beds or the blocks which uses the facing property inverted)
Testing
Some of the blocks affected (The lantern not)

Please follow our Coding Guidelines