Class RecruitmentItemsListener

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.RecruitmentItemsListener
All Implemented Interfaces:
net.minecraft.server.packs.resources.PreparableReloadListener

public class RecruitmentItemsListener extends net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener
Loads and listens to recruitment costs data.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    A recruit cost item.

    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 int
    Base item count.
    static int
    Base recruitment level.
    static final String
    Json constants
    static final String
     
    static int
    Max rarity.
  • 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)
     
    getRandomRecruitCost(int buildingLevel)
    Get a random recruit cost using the input random source.

    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 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

    • BASE_RECRUIT_LEVEL

      public static int BASE_RECRUIT_LEVEL
      Base recruitment level.
    • MAX_RARITY

      public static int MAX_RARITY
      Max rarity.
    • BASE_ITEM_COUNT

      public static int BASE_ITEM_COUNT
      Base item count. Per level of rarity it's that much less.
    • KEY_ITEM

      public static final String KEY_ITEM
      Json constants
      See Also:
    • KEY_RARITY

      public static final String KEY_RARITY
      See Also:
  • Constructor Details

    • RecruitmentItemsListener

      public RecruitmentItemsListener()
      Default constructor.
  • Method Details

    • getRandomRecruitCost

      @Nullable public static @Nullable RecruitmentItemsListener.RecruitCost getRandomRecruitCost(int buildingLevel)
      Get a random recruit cost using the input random source.
      Parameters:
      buildingLevel - the building level.
      Returns:
      a random recruit cost.
    • 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>>