Class BaseDataListener<T>

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.BaseDataListener<T>
Type Parameters:
T - the type of entry.
All Implemented Interfaces:
net.minecraft.server.packs.resources.PreparableReloadListener
Direct Known Subclasses:
StudyItemListener

public abstract class BaseDataListener<T> extends net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener
Base json reload listener class that handles part of the heavy lifting across all reload listeners.
  • 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
    Modifier
    Constructor
    Description
    protected
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final 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 profilerFiller)
     
    Map<net.minecraft.resources.ResourceLocation,T>
    Get all entries for this listener.
    protected abstract @NotNull MappingResult<T>
    mapEntry(net.minecraft.resources.ResourceLocation key, com.google.gson.JsonObject object)
    Parsed an individual entry from it's input json element.

    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

    • BaseDataListener

      protected BaseDataListener(String directory)
      Default constructor.
      Parameters:
      directory - the directory name where to look for json files.
  • Method Details

    • apply

      protected final 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 profilerFiller)
      Specified by:
      apply in class net.minecraft.server.packs.resources.SimplePreparableReloadListener<Map<net.minecraft.resources.ResourceLocation,com.google.gson.JsonElement>>
    • mapEntry

      @NotNull protected abstract @NotNull MappingResult<T> mapEntry(net.minecraft.resources.ResourceLocation key, com.google.gson.JsonObject object)
      Parsed an individual entry from it's input json element.
      Parameters:
      key - the resource key.
      object - the resource value.
      Returns:
      the mapping result.
    • getEntries

      public Map<net.minecraft.resources.ResourceLocation,T> getEntries()
      Get all entries for this listener.
      Returns:
      the map of entries.