Class CraftTweakerTagRegistry

java.lang.Object
com.blamejared.crafttweaker.api.tag.CraftTweakerTagRegistry

@ZenRegister(loaders={"crafttweaker","tags"}) public final class CraftTweakerTagRegistry extends Object
  • Field Details

  • Method Details

    • addManager

      public ITagManager<?> addManager(Class<? extends ITagManager<?>> cls)
      Adds a new ITagManager to the registry.
      Parameters:
      cls - The class of the ITagManager to add.
      Returns:
      The ITagManager that was added.
    • addManager

      public ITagManager<?> addManager(ITagManager<?> manager)
      Adds a new ITagManager to the registry.
      Parameters:
      manager - The ITagManager to add.
      Returns:
      The ITagManager that was added.
    • managers

      public Collection<ITagManager<?>> managers()
      Gets all registered ITagManager's
      Returns:
      All registered ITagManager's
    • knownManagers

      public Collection<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>> knownManagers()
      Gets all KnownTagManager's
      Returns:
      All registered KnownTagManager
    • findManager

      public <T> Optional<ITagManager<?>> findManager(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key)
      Finds a ITagManager for the given ResourceKey
      Parameters:
      key - The key to find.
      Returns:
      An optional ITagManager if found, an empty optional otherwise.
    • findKnownManager

      public <T> Optional<KnownTagManager<T>> findKnownManager(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key)
      Finds a KnownTagManager for the given ResourceKey
      Parameters:
      key - The key to find.
      Returns:
      An optional KnownTagManager if found, an empty optional otherwise.
    • tagManagerFromFolder

      public <T> Optional<? extends ITagManager<?>> tagManagerFromFolder(net.minecraft.resources.ResourceLocation tagFolder)
      Tries to get an ITagManager from the given tag folder.
      Parameters:
      tagFolder - The tag folder to get the manager of.
      Returns:
      An optional ITagManager if found, an empty optional otherwise.
    • isServerOnly

      public boolean isServerOnly(net.minecraft.resources.ResourceLocation tagFolder)
    • isKnownManager

      public boolean isKnownManager(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> key)
      Checks if the given ResourceKey is a KnownTagManager
      Parameters:
      key - The key of the manager to look for.
      Returns:
      True if there is a KnownTagManager for the given key.
    • isKnownManager

      public boolean isKnownManager(net.minecraft.resources.ResourceLocation tagFolder)
      Checks if the given tagFolder corresponds to a KnownTagManager
      Parameters:
      tagFolder - The tag folder of the manager to look for.
      Returns:
      True if there is a KnownTagManager for the given folder.
    • tagManager

      public <T> ITagManager<?> tagManager(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key)
      Gets the ITagManager corresponding to the given ResourceKey
      Parameters:
      key - The key to look for.
      Returns:
      The ITagManager for the given key.
    • knownTagManager

      public <T> KnownTagManager<T> knownTagManager(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> key)
      Gets the KnownTagManager corresponding to the given ResourceKey
      Parameters:
      key - The key to look for.
      Returns:
      The KnownTagManager for the given key.
    • tagManager

      public <T extends ITagManager<?>> T tagManager(net.minecraft.resources.ResourceLocation registryLocation)
      Gets the ITagManager corresponding to the given ResourceLocation
      Parameters:
      registryLocation - The location to look for.
      Returns:
      The ITagManager for the given location.
    • bind

      public void bind(net.minecraft.tags.TagManager tagManager)
      Binds the given TagManager to the registry.

      Note: This will clear all registered managers.

      Parameters:
      tagManager - The TagManager to bind.
    • bind

      public void bind(Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>,net.minecraft.tags.TagNetworkSerialization.NetworkPayload> tags)
      Binds the given map to the registry.

      Note: This will clear all registered managers.

      Parameters:
      tags - The map to bind.
    • bind

      public void bind(Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>,net.minecraft.tags.TagNetworkSerialization.NetworkPayload> tags, CraftTweakerTagRegistry.BindContext context)
      Binds the given map to the registry.

      Note: This will clear all registered managers.

      Parameters:
      tags - The map to bind.
      context - The bind context.
    • bind

      public void bind(List<net.minecraft.tags.TagManager.LoadResult<?>> results)
      Binds the given results to the registry.

      Note: This will clear all registered managers.

      Parameters:
      results - The results to bind.
    • bind

      public void bind(List<net.minecraft.tags.TagManager.LoadResult<?>> results, CraftTweakerTagRegistry.BindContext context)
      Binds the given results to the registry.

      Note: This will clear all registered managers.

      Parameters:
      results - The results to bind.
      context - The bind context.
    • makeTagFolder

      public String makeTagFolder(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> key)