Interface RegisterFunction<T>

Type Parameters:
T - the type being registered (e.g. Item, Block)
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface RegisterFunction<T>
Functional interface used by Electroblob's Wizardry Redux registration helpers to perform actual registrations into the different loaders' registries (Forge, Fabric).

We use this inside our registration helpers to abstract away the differences between platforms while still allowing for type safety and compile-time checks. After all the registration process is finished, each loader handle the registration of the deferred objects by calling the provided implementation of this interface.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    register(net.minecraft.core.Registry<T> registry, net.minecraft.resources.ResourceLocation id, T obj)
    Register a single object into the supplied Registry under the given ResourceLocation.
  • Method Details

    • register

      void register(net.minecraft.core.Registry<T> registry, net.minecraft.resources.ResourceLocation id, T obj)
      Register a single object into the supplied Registry under the given ResourceLocation.

      Implementations should bridge to the platform-specific registration call (Forge/Fabric or other) and ensure the provided object is registered under the supplied id.

      Parameters:
      registry - the Registry to register into, may be null when the registry instance is not required by the caller
      id - the ResourceLocation to register the object under
      obj - the object instance to register