Class ServerStatsCounter

java.lang.Object
net.minecraft.stats.StatsCounter
net.minecraft.stats.ServerStatsCounter

public class ServerStatsCounter extends StatsCounter
Server-side implementation of StatsCounter; handles counting, serialising, and de-serialising statistics, as well as sending them to connected clients via the award stats packet.
  • Field Details

    • GSON

      private static final Gson GSON
    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • STATS_CODEC

      private static final com.mojang.serialization.Codec<Map<Stat<?>,Integer>> STATS_CODEC
    • file

      private final Path file
    • dirty

      private final Set<Stat<?>> dirty
  • Constructor Details

  • Method Details

    • createTypedStatsCodec

      private static <T> com.mojang.serialization.Codec<Map<Stat<?>,Integer>> createTypedStatsCodec(StatType<T> type)
    • save

      public void save()
    • setValue

      public void setValue(Player player, Stat<?> stat, int count)
      Overrides:
      setValue in class StatsCounter
    • getDirty

      private Set<Stat<?>> getDirty()
    • parse

      public void parse(com.mojang.datafixers.DataFixer fixerUpper, JsonElement element)
    • toJson

      protected JsonElement toJson()
    • markAllDirty

      public void markAllDirty()
    • sendStats

      public void sendStats(ServerPlayer player)