Class JsonCodecProvider<T>

java.lang.Object
net.minecraftforge.common.data.JsonCodecProvider<T>
Type Parameters:
T - the type of thing being generated.
All Implemented Interfaces:
DataProvider
Direct Known Subclasses:
SpriteSourceProvider

public class JsonCodecProvider<T> extends Object implements DataProvider

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 
 
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • output

      protected final PackOutput output
    • existingFileHelper

      protected final ExistingFileHelper existingFileHelper
    • modid

      protected final String modid
    • dynamicOps

      protected final com.mojang.serialization.DynamicOps<com.google.gson.JsonElement> dynamicOps
    • packType

      protected final PackType packType
    • directory

      protected final String directory
    • codec

      protected final com.mojang.serialization.Codec<T> codec
    • entries

      protected final Map<ResourceLocation,T> entries
    • conditions

      protected Map<ResourceLocation,ICondition[]> conditions
  • Constructor Details

    • JsonCodecProvider

      public JsonCodecProvider(PackOutput output, ExistingFileHelper existingFileHelper, String modid, com.mojang.serialization.DynamicOps<com.google.gson.JsonElement> dynamicOps, PackType packType, String directory, com.mojang.serialization.Codec<T> codec, Map<ResourceLocation,T> entries)
      Parameters:
      output - PackOutput provided by the DataGenerator.
      dynamicOps - DynamicOps to encode values to jsons with using the provided Codec, e.g. JsonOps.INSTANCE.
      packType - PackType specifying whether to generate entries in assets or data.
      directory - String representing the directory to generate jsons in, e.g. "dimension" or "cheesemod/cheese".
      codec - Codec to encode values to jsons with using the provided DynamicOps.
      entries - Map of named entries to serialize to jsons. Paths for values are derived from the ResourceLocation's entryid:entrypath as specified above.
  • Method Details