tutorial:gamerule
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:gamerule [2025/12/09 18:57] – [Registering a Gamerule] solacekairos | tutorial:gamerule [2025/12/09 19:10] (current) – 1.21.11 lang-file change for gamerules' identifier(s) solacekairos | ||
|---|---|---|---|
| Line 17: | Line 17: | ||
| ==== Using the gamerule ==== | ==== Using the gamerule ==== | ||
| - | To get access to the value of a game rule you need to get the server world: | + | To get access to the value of a gamerule, use a server-world: |
| <code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
| - | world.getGameRules().getBoolean(SHOULD_PIGS_FLY) | + | serverWorld.getGameRules().getValue(CUSTOM_GAMERULE); |
| </ | </ | ||
| ==== Translation ==== | ==== Translation ==== | ||
| - | The registered gamerule | + | The registered gamerule shows up untranslated in the gamerule |
| - | To translate the name, add a '' | + | To translate the name, add an entry in the lang-file |
| <code json> | <code json> | ||
| { | { | ||
| - | " | + | " |
| } | } | ||
| </ | </ | ||
tutorial/gamerule.1765306622.txt.gz · Last modified: 2025/12/09 18:57 by solacekairos