Class DiseasesListener
java.lang.Object
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapply(@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 DiseasegetDisease(net.minecraft.resources.ResourceLocation id) Get a specific disease by id.Get a collection of all possible diseases.static @Nullable DiseasegetRandomDisease(net.minecraft.util.RandomSource random) Get a random disease from the list of diseases.static voidreadGlobalDiseasesPackets(net.minecraft.network.FriendlyByteBuf byteBuf) Read the data from the packet and parse it.static voidsendGlobalDiseasesPackets(net.minecraft.server.level.ServerPlayer player) Sync to client.Methods inherited from class net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener
getPreparedPath, prepare, scanDirectoryMethods inherited from class net.minecraft.server.packs.resources.SimplePreparableReloadListener
reloadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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.FriendlyByteBuf byteBuf) Read the data from the packet and parse it.- Parameters:
byteBuf- pck.
-
getDiseases
Get a collection of all possible diseases.- Returns:
- the collection of diseases.
-
getDisease
Get a specific disease by id.- Parameters:
id- the disease id.- Returns:
- the disease instance or null if it does not exist.
-
getRandomDisease
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:
applyin classnet.minecraft.server.packs.resources.SimplePreparableReloadListener<Map<net.minecraft.resources.ResourceLocation,com.google.gson.JsonElement>>
-