Class ForgeRegistryHelper

java.lang.Object
net.xun.lib.forge.api.registries.ForgeRegistryHelper

public class ForgeRegistryHelper extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> net.minecraftforge.registries.IForgeRegistry<T>
    getForgeRegistry(net.minecraft.core.Registry<T> registry)
    Retrieves the Forge registry equivalent of a Minecraft registry.
    static <T> Optional<net.minecraftforge.registries.IForgeRegistry<T>>
    getForgeRegistrySafe(net.minecraft.core.Registry<T> registry)
    Safely retrieves the Forge registry equivalent of a Minecraft registry.
    static boolean
    registryExists(net.minecraft.core.Registry<?> registry)
    Checks if a Forge registry exists for the given Minecraft registry.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getForgeRegistry

      @Nonnull public static <T> net.minecraftforge.registries.IForgeRegistry<T> getForgeRegistry(net.minecraft.core.Registry<T> registry)
      Retrieves the Forge registry equivalent of a Minecraft registry.
      Parameters:
      registry - The Minecraft registry to convert
      Returns:
      The corresponding Forge registry
      Throws:
      IllegalArgumentException - if no matching Forge registry exists
      ClassCastException - if the registry type doesn't match the expected type
    • getForgeRegistrySafe

      @Nonnull public static <T> Optional<net.minecraftforge.registries.IForgeRegistry<T>> getForgeRegistrySafe(net.minecraft.core.Registry<T> registry)
      Safely retrieves the Forge registry equivalent of a Minecraft registry.
      Parameters:
      registry - The Minecraft registry to convert
      Returns:
      Optional containing the Forge registry, or empty if not found
    • registryExists

      public static boolean registryExists(net.minecraft.core.Registry<?> registry)
      Checks if a Forge registry exists for the given Minecraft registry.