Class MycelRegistry<T>

java.lang.Object
my.celium.org.registry.MycelRegistry<T>

public final class MycelRegistry<T> extends Object
Minimal deferred registration covering the repetitive cases (items, blocks, entity types) without a universal registry framework.
MycelRegistry<Item> items = MycelRegistry.items(META);
DeferredEntry<Item> widget = items.registerWithKey("widget",
        key -> new Item(new Item.Properties().setId(key)));

Minecraft 26.x refuses items and blocks whose properties carry no id, so use registerWithKey(String, Function) (or key) for those.

Names must be lowercase [a-z0-9_/.-] paths. Registration timing is owned by the loader bridge: call register during mod construction / entrypoint execution. Resolving (DeferredEntry.get()) before the loader creates the object throws - read entries lazily (in handlers, not in static initialisers).

  • Method Details

    • items

      public static MycelRegistry<net.minecraft.world.item.Item> items(ModMetadata mod)
    • blocks

      public static MycelRegistry<net.minecraft.world.level.block.Block> blocks(ModMetadata mod)
    • entityTypes

      public static MycelRegistry<net.minecraft.world.entity.EntityType<?>> entityTypes(ModMetadata mod)
    • register

      public DeferredEntry<T> register(String name, Supplier<T> factory)
      Registers factory under modid:name. The factory runs at the loader's registration time, never earlier.
    • registerWithKey

      public DeferredEntry<T> registerWithKey(String name, Function<net.minecraft.resources.ResourceKey<T>, T> factory)
      Like register(String, Supplier), but hands the factory the entry's own key, which Item.Properties.setId and BlockBehaviour.Properties.setId need.
    • key

      public net.minecraft.resources.ResourceKey<T> key(String name)
      The key modid:name in this registry.