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

Update conventions #4127

Open
wants to merge 4 commits into
base: 25w10a
Choose a base branch
from
Open

Conversation

apple502j
Copy link
Contributor

Updates the convention document to codify unwritten rules and traditions and clarify some rules.

@apple502j apple502j requested a review from a team as a code owner February 18, 2025 15:06
Juuxel
Juuxel previously approved these changes Feb 18, 2025
@@ -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.
Copy link
Member

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)

Copy link
Contributor

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.
Copy link
Member

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: Octol1ttle <[email protected]>
@modmuss50 modmuss50 added the update-base Add this label to a pull request to automatically change the target branch to the default branch. label Feb 27, 2025
@github-actions github-actions bot changed the base branch from 25w07a to 25w09b February 27, 2025 13:53
@github-actions github-actions bot dismissed Juuxel’s stale review February 27, 2025 13:53

The base branch was changed.

Copy link
Contributor

🚀 Target branch has been updated to 25w09b

@github-actions github-actions bot added snapshot A PR that targets a snapshot version of Minecraft and removed update-base Add this label to a pull request to automatically change the target branch to the default branch. labels Feb 27, 2025
modmuss50
modmuss50 previously approved these changes Feb 27, 2025

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.
Copy link
Contributor

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.
Copy link
Contributor

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.

@apple502j apple502j changed the base branch from 25w09b to 25w10a March 9, 2025 14:15
@apple502j apple502j dismissed modmuss50’s stale review March 9, 2025 14:15

The base branch was changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
snapshot A PR that targets a snapshot version of Minecraft
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants