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 -
Method Summary
Modifier and TypeMethodDescriptionprotected final 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 profilerFiller) 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, scanDirectoryMethods inherited from class net.minecraft.server.packs.resources.SimplePreparableReloadListener
reloadMethods inherited from class net.neoforged.neoforge.resource.ContextAwareReloadListener
getContext, getRegistryLookup, injectContext, makeConditionalOpsMethods 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
-
BaseDataListener
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:
applyin classnet.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
Get all entries for this listener.- Returns:
- the map of entries.
-