tutorial:stats
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
tutorial:stats [2021/02/08 18:50] – remove formating line break from code jummit | tutorial:stats [2021/02/08 22:05] – specify that getOrCreateStat adds the stat to the stat screen jummit | ||
---|---|---|---|
Line 14: | Line 14: | ||
</ | </ | ||
- | Then specify the stat formatter. It determines how the number is shown in the Statistics screen. You can use DEFAULT, DIVIDE_BY_TEN, | + | Then add the stat to the statistic screen, where you can also specify the stat formatter. It determines how the number is shown in the stat list. You can use DEFAULT, DIVIDE_BY_TEN, |
<code java> | <code java> | ||
Line 27: | Line 27: | ||
@Override | @Override | ||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { | public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { | ||
- | if (!world.isClient) { | + | player.incrementStat(ModClass.INTERACT_WITH_COOL_BLOCK); |
- | player.incrementStat(ModClass.INTERACT_WITH_COOL_BLOCK); | + | |
- | } | + | |
return ActionResult.SUCCESS; | return ActionResult.SUCCESS; |
tutorial/stats.txt · Last modified: 2021/02/08 22:05 by 127.0.0.1