Class DeferredRegister<T>

java.lang.Object
net.minecraftforge.registries.DeferredRegister<T>
Type Parameters:
T - The base registry type

public class DeferredRegister<T> extends Object
Utility class to help with managing registry entries. Maintains a list of all suppliers for entries and registers them during the proper Register event. Suppliers should return NEW instances every time. Example Usage:

   private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
   private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);

   public static final RegistryObject<Block> ROCK_BLOCK = BLOCKS.register("rock", () -> new Block(Block.Properties.create(Material.ROCK)));
   public static final RegistryObject<Item> ROCK_ITEM = ITEMS.register("rock", () -> new BlockItem(ROCK_BLOCK.get(), new Item.Properties().group(ItemGroup.MISC)));

   public ExampleMod() {
       ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
       BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
   }