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
FieldsModifier and TypeFieldDescriptionprotected final com.mojang.serialization.Codec<T> protected final Map<ResourceLocation, WithConditions<T>> protected final Stringprotected final ExistingFileHelperprivate static final org.slf4j.Loggerprotected final CompletableFuture<HolderLookup.Provider> protected final Stringprotected final PackOutput.PathProviderprotected final ExistingFileHelper.ResourceTypeFields inherited from interface net.minecraft.data.DataProvider
FIXED_ORDER_FIELDS, KEY_COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionJsonCodecProvider(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 TypeMethodDescriptionvoidconditionally(ResourceLocation id, Consumer<WithConditions.Builder<T>> configurator) protected abstract voidgather()getName()private voidprocess(ResourceLocation id, WithConditions<T> withConditions) run(CachedOutput cache) voidunconditional(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:
runin interfaceDataProvider
-
gather
protected abstract void gather() -
getName
- Specified by:
getNamein interfaceDataProvider
-
unconditional
-
conditionally
-
process
-