tutorial:stats
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:stats [2021/02/08 22:05] – specify that getOrCreateStat adds the stat to the stat screen jummit | tutorial:stats [2024/11/18 16:45] (current) – identifier constructor is private, Registries class bemoty | ||
---|---|---|---|
Line 4: | Line 4: | ||
To add a custom statistic, create an identifier which will be used to register and increase the stat: | To add a custom statistic, create an identifier which will be used to register and increase the stat: | ||
<code java> | <code java> | ||
- | public static final Identifier INTERACT_WITH_COOL_BLOCK = new Identifier(" | + | public static final Identifier INTERACT_WITH_COOL_BLOCK = Identifier.of(" |
</ | </ | ||
Line 11: | Line 11: | ||
Then register the stat using the identifier: | Then register the stat using the identifier: | ||
<code java> | <code java> | ||
- | Registry.register(Registry.CUSTOM_STAT, | + | Registry.register(Registries.CUSTOM_STAT, |
</ | </ | ||
tutorial/stats.1612821915.txt.gz · Last modified: 2021/02/08 22:05 by jummit