Class JsonCodecProvider<T>
java.lang.Object
net.neoforged.neoforge.common.data.JsonCodecProvider<T>
- Type Parameters:
T
- the type of thing being generated.
- All Implemented Interfaces:
DataProvider
- Direct Known Subclasses:
SpriteSourceProvider
Dataprovider for using a Codec to generate jsons. Path names for jsons are derived from the given registry folder and each entry's namespaced id, in the format:
<assets/data>/entryid/registryfolder/entrypath.json
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.data.DataProvider
DataProvider.Factory<T extends DataProvider>
-
Field Summary
Modifier and TypeFieldDescriptionprotected final com.mojang.serialization.Codec
<T> protected final Map
<ResourceLocation, WithConditions<T>> protected final String
protected final ExistingFileHelper
private static final org.slf4j.Logger
protected final CompletableFuture
<HolderLookup.Provider> protected final String
protected final PackOutput.PathProvider
protected final ExistingFileHelper.ResourceType
Fields inherited from interface net.minecraft.data.DataProvider
FIXED_ORDER_FIELDS, KEY_COMPARATOR
-
Constructor Summary
ConstructorDescriptionJsonCodecProvider
(PackOutput output, PackOutput.Target target, String directory, PackType packType, com.mojang.serialization.Codec<T> codec, CompletableFuture<HolderLookup.Provider> lookupProvider, String modId, ExistingFileHelper existingFileHelper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
conditionally
(ResourceLocation id, Consumer<WithConditions.Builder<T>> configurator) protected abstract void
gather()
getName()
private void
process
(ResourceLocation id, WithConditions<T> withConditions) run
(CachedOutput cache) void
unconditional
(ResourceLocation id, T value)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
resourceType
-
pathProvider
-
existingFileHelper
-
lookupProvider
-
modid
-
directory
-
codec
-
conditions
-
-
Constructor Details
-
JsonCodecProvider
public JsonCodecProvider(PackOutput output, PackOutput.Target target, String directory, PackType packType, com.mojang.serialization.Codec<T> codec, CompletableFuture<HolderLookup.Provider> lookupProvider, String modId, ExistingFileHelper existingFileHelper) - Parameters:
output
- PackOutput provided by theDataGenerator
.directory
- String representing the directory to generate jsons in, e.g. "dimension" or "cheesemod/cheese".packType
- PackType specifying whether to generate entries in assets or data.codec
- Codec to encode values to jsons with using the provided DynamicOps.
-
-
Method Details
-
run
- Specified by:
run
in interfaceDataProvider
-
gather
protected abstract void gather() -
getName
- Specified by:
getName
in interfaceDataProvider
-
unconditional
-
conditionally
-
process
-