-
Notifications
You must be signed in to change notification settings - Fork 393
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
Update conventions #4127
base: 25w10a
Are you sure you want to change the base?
Update conventions #4127
Conversation
@@ -64,6 +82,7 @@ name patterns you should use. | |||
### Ticks and updates | |||
|
|||
Use "tick" for updates done once per tick. Use "update" for other kind of updates. | |||
Note that "tick" is used in block-related code for things that are not performed once per tick for historical reasons. For example, neither `randomTick` nor `scheduledTick` gets called once per tick. |
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.
Nit: not solely historical reasons but also game strings (randomTickSpeed
etc)
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.
I think even outside of the game's terminology, this section is misleading. Random ticks and scheduled ticks are both tick-bound but simply filter which ticks they are called on based on randomness or a preset schedule respectively. I assume the purpose of this section is to clarify the naming of method names like tickMovement
, tickCooldown
, or similar, so it could be reworded to make that more clear.
|
||
### Other conventions | ||
- Methods that register the values and return the default value (i.e. `Registries.Initializer`) should be named `registerAndGetDefault` for static registries, and `bootstrap` for dynamic registries. | ||
- Use "draw" for drawing a simple shape, such as rectangles, cubes, texts, and a texture. Use "render" for drawing something more concrete, such as the sky, blocks, entities, particles, user interfaces, and buttons. A "render" method typically includes multiple "draw" calls. |
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.
Resolves #984, I think
Co-authored-by: Juuz <[email protected]>
Co-authored-by: Octol1ttle <[email protected]>
The base branch was changed.
🚀 Target branch has been updated to 25w09b |
|
||
Exception: record components should always be prefix-less, even if it means dropping the "get" prefix from the implementing interface. | ||
|
||
For more complex computations, "find" and "calc" are frequently used. |
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.
I'm not a fan of the calc
prefix personally.
@@ -64,6 +82,7 @@ name patterns you should use. | |||
### Ticks and updates | |||
|
|||
Use "tick" for updates done once per tick. Use "update" for other kind of updates. | |||
Note that "tick" is used in block-related code for things that are not performed once per tick for historical reasons. For example, neither `randomTick` nor `scheduledTick` gets called once per tick. |
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.
I think even outside of the game's terminology, this section is misleading. Random ticks and scheduled ticks are both tick-bound but simply filter which ticks they are called on based on randomness or a preset schedule respectively. I assume the purpose of this section is to clarify the naming of method names like tickMovement
, tickCooldown
, or similar, so it could be reworded to make that more clear.
Updates the convention document to codify unwritten rules and traditions and clarify some rules.