diff --git a/content/news/20.2registry-rework.md b/content/news/20.2registry-rework.md index 49d4c37..cfc1ca6 100644 --- a/content/news/20.2registry-rework.md +++ b/content/news/20.2registry-rework.md @@ -22,7 +22,7 @@ This blog post will go through the most important changes that were made, to act as a migration guide for modders. This rework is the first of the three big reworks to land -after [our initial 20.2 release](../20.2release). +after [our initial 20.2 release](../20.2release/). The other two systems that will receive an overhaul in the coming weeks are **capabilities** and **networking**. Once these also land we will be aiming for a 20.2 stable release. @@ -82,14 +82,25 @@ Here are is an example: NeoForge also provides `DeferredHolder` and `DeferredRegister` specializations for items and blocks that implement `ItemLike`. For example: ```java +// Make sure you use the special DeferredRegister.Blocks and DeferredRegister.Items types, +// NOT DeferredRegister or DeferredRegister! private static final DeferredRegister.Blocks BLOCKS = DeferredRegister.createBlocks("mymod"); private static final DeferredRegister.Items ITEMS = DeferredRegister.createItems("mymod"); +// If you are registering blocks or items directly, use a normal `register` call: public static final DeferredBlock MY_BLOCK = BLOCKS.register("my_block", () -> new MyBlock(/* create block */)); public static final DeferredItem MY_ITEM = ITEMS.register("my_item", () -> new MyItem(/* create item */)); -// There are also a few extra helper functions, for example `registerBlockItem`: -public static final DeferredItem MY_BLOCK_ITEM = ITEMS.registerBlockItem(MY_BLOCK); +// There are also a few extra helper functions. +// `registerBlock` to directly register a `new Block` from some block properties: +public static final DeferredBlock MY_SIMPLE_BLOCK = + BLOCKS.registerBlock("simple_block", BlockBehaviour.Properties.of().mapColor(MapColor.STONE)); +// `registerItem` to directly register a `new Item` from some item properties: +public static final DeferredItem MY_SIMPLE_ITEM = + ITEMS.registerItem("simple_item", new Item.Properties().stacksTo(1)); +// `registerBlockItem` to directly register a `new BlockItem` for a block: +public static final DeferredItem MY_BLOCK_ITEM = + ITEMS.registerBlockItem(MY_BLOCK); ``` As usual, don't forget to pass your mod bus to your `DeferredRegister`s: