Class DiseasesListener

java.lang.Object
net.neoforged.neoforge.resource.ContextAwareReloadListener
net.minecraft.server.packs.resources.SimplePreparableReloadListener<Map<net.minecraft.resources.ResourceLocation,com.google.gson.JsonElement>>
net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener
com.minecolonies.core.datalistener.DiseasesListener
All Implemented Interfaces:
net.minecraft.server.packs.resources.PreparableReloadListener

public class DiseasesListener extends net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener
Loads and listens to diseases data.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener

    net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    apply(@NotNull Map<net.minecraft.resources.ResourceLocation,com.google.gson.JsonElement> jsonElementMap, @NotNull net.minecraft.server.packs.resources.ResourceManager resourceManager, @NotNull net.minecraft.util.profiling.ProfilerFiller profiler)
     
    static @Nullable Disease
    getDisease(net.minecraft.resources.ResourceLocation id)
    Get a specific disease by id.
    static @NotNull List<Disease>
    Get a collection of all possible diseases.
    static @Nullable Disease
    getRandomDisease(net.minecraft.util.RandomSource random)
    Get a random disease from the list of diseases.
    static void
    readGlobalDiseasesPackets(net.minecraft.network.RegistryFriendlyByteBuf byteBuf)
    Read the data from the packet and parse it.
    static void
    sendGlobalDiseasesPackets(net.minecraft.server.level.ServerPlayer player)
    Sync to client.

    Methods inherited from class net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener

    getPreparedPath, prepare, scanDirectory

    Methods inherited from class net.minecraft.server.packs.resources.SimplePreparableReloadListener

    reload

    Methods inherited from class net.neoforged.neoforge.resource.ContextAwareReloadListener

    getContext, getRegistryLookup, injectContext, makeConditionalOps

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener

    getName
  • Constructor Details

    • DiseasesListener

      public DiseasesListener()
      Default constructor.
  • Method Details

    • sendGlobalDiseasesPackets

      public static void sendGlobalDiseasesPackets(net.minecraft.server.level.ServerPlayer player)
      Sync to client.
      Parameters:
      player - to send it to.
    • readGlobalDiseasesPackets

      public static void readGlobalDiseasesPackets(net.minecraft.network.RegistryFriendlyByteBuf byteBuf)
      Read the data from the packet and parse it.
      Parameters:
      byteBuf - pck.
    • getDiseases

      @NotNull public static @NotNull List<Disease> getDiseases()
      Get a collection of all possible diseases.
      Returns:
      the collection of diseases.
    • getDisease

      @Nullable public static @Nullable Disease getDisease(net.minecraft.resources.ResourceLocation id)
      Get a specific disease by id.
      Parameters:
      id - the disease id.
      Returns:
      the disease instance or null if it does not exist.
    • getRandomDisease

      @Nullable public static @Nullable Disease getRandomDisease(net.minecraft.util.RandomSource random)
      Get a random disease from the list of diseases.
      Parameters:
      random - the input random source.
      Returns:
      the random disease instance or null if no diseases exist.
    • apply

      protected void apply(@NotNull @NotNull Map<net.minecraft.resources.ResourceLocation,com.google.gson.JsonElement> jsonElementMap, @NotNull @NotNull net.minecraft.server.packs.resources.ResourceManager resourceManager, @NotNull @NotNull net.minecraft.util.profiling.ProfilerFiller profiler)
      Specified by:
      apply in class net.minecraft.server.packs.resources.SimplePreparableReloadListener<Map<net.minecraft.resources.ResourceLocation,com.google.gson.JsonElement>>