Class DatagenSystem

java.lang.Object
org.moddingx.libx.datagen.DatagenSystem

public class DatagenSystem extends Object
  • Method Details

    • registerExtensionRegistry

      public static void registerExtensionRegistry(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> registryKey)
      Marks a registry as an extension registry. An extension registry is a registry, where the id of the elements reference the id inside another registry (for example LibX biome surface). Extension registries are frozen later during datagen to allow them access to frozen non-extension registries while being populated.
      See Also:
    • extensionRegistries

      public static Set<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>> extensionRegistries()
      Gets a set of all extension.registries.
      See Also:
    • create

      public static void create(ModX mod, Consumer<DatagenSystem> configure)
      Registers a datagen system for the given mod and executes the provided configuration action when running datagen. Calling this method multiple times for the same mod will only create a single datagen system but invoke all configuration in order.
    • mod

      public ModX mod()
    • fileHelper

      public net.minecraftforge.common.data.ExistingFileHelper fileHelper()
    • mainTarget

      public PackTarget mainTarget()
      The main pack target.
    • mainOutput

      public Path mainOutput()
      The main output path. Use PackTarget.path(PackType) instead of this whenever possible.
    • setResourceRoot

      public void setResourceRoot(String root)
      Sets the resource root relative to the game dir. This is used to allow resource lookup in dynamic pack targets.
    • nestedDatapack

      public PackTarget nestedDatapack(net.minecraft.resources.ResourceLocation id, PackTarget... parents)
      Creates a pack target for a vanilla-style nested datapack inside the first given parent. Client resources can't be output on this target.
    • dynamic

      public PackTarget dynamic(String id, net.minecraft.server.packs.PackType type, PackTarget... parents)
      Creates a pack target for a LibX dynamic pack. For resource packs, server data output defaults to the first parent, for data packs, client resource output defaults to the first parent.
    • join

      public PackTarget join(PackTarget resources, PackTarget data)
      Joins two pack targets, using one for client resource output and the other one for server data output.
    • makePackTarget

      public DatagenSystem.PackTargetBuilder makePackTarget(String name, PackTarget... parents)
      Creates a new builder for a PackTarget. The registries for this pack target will contain all elements from the parents registries. The output locations default to the output locations of the first parent. If no parents are given, mainTarget() is assumed.
    • addRegistryProvider

      public void addRegistryProvider(Function<DatagenContext,RegistryProvider> provider)
      Adds a provider to run in the registry setup stage.
    • addRegistryProvider

      public void addRegistryProvider(PackTarget target, Function<DatagenContext,RegistryProvider> provider)
      Adds a provider to run in the registry setup stage.
    • addExtensionProvider

      public void addExtensionProvider(Function<DatagenContext,RegistryProvider> provider)
      Adds a provider to run in the extension setup stage.
    • addExtensionProvider

      public void addExtensionProvider(PackTarget target, Function<DatagenContext,RegistryProvider> provider)
      Adds a provider to run in the extension setup stage.
    • addDataProvider

      public void addDataProvider(Function<DatagenContext,net.minecraft.data.DataProvider> provider)
      Adds a provider to run in the datagen stage.
    • addDataProvider

      public void addDataProvider(PackTarget target, Function<DatagenContext,net.minecraft.data.DataProvider> provider)
      Adds a provider to run in the datagen stage.