Class ColonyStoryListener

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.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 Classes
    Modifier and Type
    Class
    Description
    static final record 
    A 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

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.resources.ResourceLocation
    Names for abandoned colonies.
    static final net.minecraft.resources.ResourceLocation
    Stories for abandoned colonies.
    List of story and lore elements loaded from data.
     
    static final net.minecraft.resources.ResourceLocation
    Stories for supply camps.
    static final net.minecraft.resources.ResourceLocation
    Stories for supply ships.
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a new listener.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    apply(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 void
    modInitClient(net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent event)
     
    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.

    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
  • Field Details

    • ABANDONED_COLONY_NAME

      public static final net.minecraft.resources.ResourceLocation ABANDONED_COLONY_NAME
      Names for abandoned colonies.
    • ABANDONED_COLONY_STORY

      public static final net.minecraft.resources.ResourceLocation ABANDONED_COLONY_STORY
      Stories for abandoned colonies.
    • SUPPLY_CAMP_STORY

      public static final net.minecraft.resources.ResourceLocation SUPPLY_CAMP_STORY
      Stories for supply camps.
    • SUPPLY_SHIP_STORY

      public static final net.minecraft.resources.ResourceLocation SUPPLY_SHIP_STORY
      Stories for supply ships.
    • abandonedColonyNames

      public static Set<ColonyStoryListener.StoryText> abandonedColonyNames
      List of story and lore elements loaded from data.
    • abandonedColonyStories

      public static Set<ColonyStoryListener.StoryText> abandonedColonyStories
    • supplyShipStories

      public static Set<ColonyStoryListener.StoryText> supplyShipStories
    • supplyCampStories

      public static Set<ColonyStoryListener.StoryText> supplyCampStories
  • Constructor Details

    • ColonyStoryListener

      public ColonyStoryListener()
      Create a new listener.
  • Method Details

    • modInitClient

      public static void modInitClient(net.neoforged.neoforge.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:
      apply in class net.minecraft.server.packs.resources.SimplePreparableReloadListener<Map<net.minecraft.resources.ResourceLocation,com.google.gson.JsonElement>>