Package com.minecolonies.core.event
Class ColonyStoryListener
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.event.ColonyStoryListener
- All Implemented Interfaces:
net.minecraft.server.packs.resources.PreparableReloadListener
public class ColonyStoryListener
extends net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener
Loads and listens to colony story changes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA bit of story text that is filterable by biome.Nested classes/interfaces inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocationNames for abandoned colonies.static final net.minecraft.resources.ResourceLocationStories for abandoned colonies.static Set<ColonyStoryListener.StoryText>List of story and lore elements loaded from data.static Set<ColonyStoryListener.StoryText>static final net.minecraft.resources.ResourceLocationStories for supply camps.static final net.minecraft.resources.ResourceLocationStories for supply ships.static Set<ColonyStoryListener.StoryText>static Set<ColonyStoryListener.StoryText> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapply(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 voidmodInitClient(net.minecraftforge.client.event.RegisterClientReloadListenersEvent event) static StringpickRandom(Collection<ColonyStoryListener.StoryText> stories, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biome, Random rng) Pick a random entry from the given set of story texts.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
-
Field Details
-
ABANDONED_COLONY_NAME
public static final net.minecraft.resources.ResourceLocation ABANDONED_COLONY_NAMENames for abandoned colonies. -
ABANDONED_COLONY_STORY
public static final net.minecraft.resources.ResourceLocation ABANDONED_COLONY_STORYStories for abandoned colonies. -
SUPPLY_CAMP_STORY
public static final net.minecraft.resources.ResourceLocation SUPPLY_CAMP_STORYStories for supply camps. -
SUPPLY_SHIP_STORY
public static final net.minecraft.resources.ResourceLocation SUPPLY_SHIP_STORYStories for supply ships. -
abandonedColonyNames
List of story and lore elements loaded from data. -
abandonedColonyStories
-
supplyShipStories
-
supplyCampStories
-
-
Constructor Details
-
ColonyStoryListener
public ColonyStoryListener()Create a new listener.
-
-
Method Details
-
modInitClient
public static void modInitClient(net.minecraftforge.client.event.RegisterClientReloadListenersEvent event) -
pickRandom
public static String pickRandom(Collection<ColonyStoryListener.StoryText> stories, net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biome, Random rng) Pick a random entry from the given set of story texts.- Parameters:
stories- the set of story texts to pick from.biome- biomes to filter the stories against.rng- random number source.- Returns:
- one of the stories, at random.
-
apply
protected void apply(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>>
-