11package io .github .codecraftplugin .registrylib .utils ;
22
3- import net .fabricmc .fabric .api .item .v1 .FabricItemSettings ;
3+ // import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
44import net .fabricmc .fabric .api .itemgroup .v1 .FabricItemGroup ;
55import net .fabricmc .fabric .api .itemgroup .v1 .ItemGroupEvents ;
66import net .fabricmc .loader .api .FabricLoader ;
@@ -34,7 +34,7 @@ public class Registry {
3434 * @return the item will be created and returned
3535 */
3636 public static Item registerItems (String name , String MOD_ID , Item item , RegistryKey <ItemGroup > itemGroup ){
37- Item createditem = net .minecraft .registry .Registry .register (Registries .ITEM ,new Identifier (MOD_ID ,name ),item );
37+ Item createditem = net .minecraft .registry .Registry .register (Registries .ITEM ,Identifier . of (MOD_ID ,name ),item );
3838 addToItemGroup (itemGroup ,createditem );
3939 return createditem ;
4040 }
@@ -48,7 +48,7 @@ public static Item registerItems(String name, String MOD_ID, Item item, Registry
4848 */
4949 public static Block registerBlocks (String name , String MOD_ID , Block block , RegistryKey <ItemGroup > itemGroup ){
5050 registerBlockItem (name ,MOD_ID ,block ,itemGroup );
51- return net .minecraft .registry .Registry .register (Registries .BLOCK ,new Identifier (MOD_ID ,name ),block );
51+ return net .minecraft .registry .Registry .register (Registries .BLOCK ,Identifier . of (MOD_ID ,name ),block );
5252 }
5353
5454 /**
@@ -60,8 +60,8 @@ public static Block registerBlocks(String name, String MOD_ID, Block block, Regi
6060 * @return the block item without creating the block (for crops)
6161 */
6262 public static Item registerBlockItem (String name , String MOD_ID , Block block , RegistryKey <ItemGroup > itemGroup ) {
63- Item blockItem = net .minecraft .registry .Registry .register (Registries .ITEM ,new Identifier (MOD_ID ,name ),
64- new BlockItem (block ,new FabricItemSettings ()));
63+ Item blockItem = net .minecraft .registry .Registry .register (Registries .ITEM ,Identifier . of (MOD_ID ,name ),
64+ new BlockItem (block ,new Item . Settings ()));
6565 addToItemGroup (itemGroup ,blockItem );
6666 return blockItem ;
6767 }
@@ -75,7 +75,7 @@ public static Item registerBlockItem(String name, String MOD_ID, Block block, Re
7575 */
7676 public static RegistryKey <ItemGroup > registerItemGroup (String name , String MOD_ID , Supplier <ItemStack > itemStack ){
7777 String displayName = formatString (name );
78- RegistryKey <ItemGroup > customItemGroup = RegistryKey .of (RegistryKeys .ITEM_GROUP ,new Identifier (MOD_ID ,name ));
78+ RegistryKey <ItemGroup > customItemGroup = RegistryKey .of (RegistryKeys .ITEM_GROUP ,Identifier . of (MOD_ID ,name ));
7979 net .minecraft .registry .Registry .register (Registries .ITEM_GROUP , customItemGroup , FabricItemGroup .builder ()
8080 .icon (itemStack ).displayName (Text .literal (displayName )).build ());
8181
@@ -101,7 +101,7 @@ public static void addToItemGroup(RegistryKey<ItemGroup> group, Item item) {
101101 */
102102 public static Block registerBlocksWithoutBlockItem (String name , String MOD_ID , Block block ){
103103 //register the block without block items, so you have to register it manually using registerItems
104- return net .minecraft .registry .Registry .register (Registries .BLOCK ,new Identifier (MOD_ID ,name ),block );
104+ return net .minecraft .registry .Registry .register (Registries .BLOCK ,Identifier . of (MOD_ID ,name ),block );
105105 }
106106
107107 /**
@@ -113,7 +113,7 @@ public static Block registerBlocksWithoutBlockItem(String name, String MOD_ID, B
113113 * @return the enchantment
114114 */
115115 public static Enchantment registerEnchantments (String name , Enchantment enchantment , String MOD_ID ){
116- return net .minecraft .registry .Registry .register (Registries .ENCHANTMENT , new Identifier (MOD_ID , name ),enchantment );
116+ return net .minecraft .registry .Registry .register (Registries ., Identifier . of (MOD_ID , name ),enchantment );
117117
118118 }
119119
@@ -125,7 +125,7 @@ public static Enchantment registerEnchantments(String name, Enchantment enchantm
125125 * @return
126126 */
127127 private static FlowableFluid registerFluids (String name , String MOD_ID ,FlowableFluid flowableFluid ) {
128- return net .minecraft .registry .Registry .register (Registries .FLUID , new Identifier (MOD_ID , name ), flowableFluid );
128+ return net .minecraft .registry .Registry .register (Registries .FLUID , Identifier . of (MOD_ID , name ), flowableFluid );
129129 }
130130 public static void registerRegistry (Logger logger ){
131131 logger .info ("registered all the registry" );
@@ -140,7 +140,7 @@ public static void registerRegistry(Logger logger){
140140 * @return The Entity
141141 */
142142 public static EntityType registerEntity (String name ,String MOD_ID , EntityType entity ){
143- return net .minecraft .registry .Registry .register (Registries .ENTITY_TYPE , new Identifier (MOD_ID ,name ),entity );
143+ return net .minecraft .registry .Registry .register (Registries .ENTITY_TYPE , Identifier . of (MOD_ID ,name ),entity );
144144 }
145145 //register status effects
146146
@@ -153,15 +153,15 @@ public static EntityType registerEntity(String name,String MOD_ID, EntityType en
153153 * @return the status effect
154154 */
155155 public static StatusEffect registerStatusEffects (String name ,String MOD_ID , StatusEffect statusEffect ){
156- return net .minecraft .registry .Registry .register (Registries .STATUS_EFFECT , new Identifier (MOD_ID , name ), statusEffect );
156+ return net .minecraft .registry .Registry .register (Registries .STATUS_EFFECT , Identifier . of (MOD_ID , name ), statusEffect );
157157 }
158158 //register entities with spawn egg
159159
160160 public static <T extends Entity > EntityType <T > buildEntity (EntityType .EntityFactory <T > entity , Class <T > entityClass ,
161161 float width , float height , SpawnGroup group , String MOD_ID ) {
162162 if (FabricLoader .getInstance ().isDevelopmentEnvironment ()) {
163163 String name = entityClass .getSimpleName ().toLowerCase ();
164- return EntityRegistryBuilder .<T >createBuilder (new Identifier (MOD_ID , name )).entity (entity )
164+ return EntityRegistryBuilder .<T >createBuilder (Identifier . of (MOD_ID , name )).entity (entity )
165165 .category (group ).dimensions (EntityDimensions .changing (width , height )).build ();
166166 }
167167 return null ;
0 commit comments