What happened to registering blocks with custom itemblocks?
Adding Crafting Recipes in code? This no longer works
ForgeRegistries.RECIPES.register(new ItemStack(oldMap), new Object[]{"xxx","xyx","xxx",'x',Items.PAPER,'y',Items.COMPASS});//Adds My map to the registry
I would like to use a simple method like that without every recipe being an IRecipe interface.
What happened to registering blocks with custom itemblocks?
ItemBlocks are registered in the same way as any other Item, just create an instance, set its registry name and register it with IForgeRegistry#register/registerAll.
Adding Crafting Recipes in code? This no longer works
ForgeRegistries.RECIPES.register(new ItemStack(oldMap), new Object[]{"xxx","xyx","xxx",'x',Items.PAPER,'y',Items.COMPASS});//Adds My map to the registry
Calling IForgeRegistry#register for a recipe requires you to create the IRecipe instance yourself. GameRegistry.addShapedRecipe and GameRegistry.addShapelessRecipe still exist, you can use these to add shaped/shapeless recipes in the old way. This should be done in RegistryEvent.Register<IRecipe>.
The whole point of vararg methods is that Java automatically creates the array for you, you don't need to create it yourself.
That said, you should be using the JSON recipe system instead of adding recipes in code.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
ItemBlocks are registered in the same way as any other Item, just create an instance, set its registry name and register it with IForgeRegistry#register/registerAll.
Sorry I didn't see I commented that again I accidentally commented that twice or three times I was just asking about the recipes.
GameRegistry.addShapedRecipe and GameRegistry.addShapelessRecipe still exist, you can use these to add
I remember trying add shaped GameRegistry#addrecipe() and it didn't function the same as GameRegistry#ddShapedRecipe(). Is this still the case? .jsons require actual files when I could register thousands of recipes from code at once If I felt like it without actual files. I could never get the GameRegistry#addShapedRecipe working so I always used addrecipe()
I remember trying add shaped GameRegistry#addrecipe() and it didn't function the same as GameRegistry#ddShapedRecipe(). Is this still the case? .jsons require actual files when I could register thousands of recipes from code at once If I felt like it without actual files. I could never get the GameRegistry#addShapedRecipe working so I always used addrecipe()
In 1.11.2 and earlier, GameRegistry.addRecipe(ItemStack, Object...) did nothing but call GameRegistry.addShapedRecipe. The two methods did exactly the same thing. GameRegistry.addRecipe(IRecipe) allowed you to add an IRecipe instance that you'd already created yourself.
In 1.12+, both overloads of GameRegistry.addRecipe have been removed; only GameRegistry.addShapedRecipe and GameRegistry.addShapelessRecipe remain. These perform the same function as they did in 1.11.2 and earlier, i.e. creating and registering an instance of ShapedRecipes/ShapelessRecipes from the specified output and input.
You should use the JSON recipe system for every recipe unless there's a specific reason that it wouldn't work (not just a hypothetical "I could register thousands of recipes if I wanted to"). Forge allows you to extend it by adding new condition, recipe and ingredient types; so it's not just limited to simple vanilla-style recipes.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
extend recipes is this an IRecipe Class thing or what? Send me the documentation I will take a look at it.
I was using "extend" in the general sense here, i.e. "add more stuff". I wasn't specifically talking about extending a class.
There's not much documentation on the JSON recipe system, so I'll briefly explain how to add custom recipe, ingredient and condition types.
To add a custom recipe type, first create a class that either extends an existing IRecipe implementation (e.g. ShapedRecipes) or implements IRecipe and extends IForgeRegistryEntry.Impl. You then create a class that implements IRecipeFactory and deserialises the custom recipe type from the provided JSON object.
To add a custom ingredient type, first create a class extends Ingredient or a subclass (skip this step if an existing Ingredient class provides the required functionality). You then create a class that implements IIngredientFactory and deserialises the custom ingredient type from the provided JSON object.
To add a custom condition type, create a class that implements IConditionFactory and deserialises the condition (a BooleanSupplier) from the provided JSON object. You can implement BooleanSupplier with a class (named or anonymous), lambda or method reference.
Create a file called _factories.json in assets/<modid>/recipes that specifies your IRecipeFactory, IIngredientFactory and IConditionFactory classes.
You can see some examples of custom recipe and ingredient implements here and some examples of the JSON files here.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I was using "extend" in the general sense here, i.e. "add more stuff". I wasn't specifically talking about extending a class.
There's not much documentation on the JSON recipe system, so I'll briefly explain how to add custom recipe, ingredient and condition types.
To add a custom recipe type, first create a class that either extends an existing IRecipe implementation (e.g. ShapedRecipes) or implements IRecipe and extends IForgeRegistryEntry.Impl. You then create a class that implements IRecipeFactory and deserialises the custom recipe type from the provided JSON object.
To add a custom ingredient type, first create a class extends Ingredient or a subclass (skip this step if an existing Ingredient class provides the required functionality). You then create a class that implements IIngredientFactory and deserialises the custom ingredient type from the provided JSON object.
To add a custom condition type, create a class that implements IConditionFactory and deserialises the condition (a BooleanSupplier) from the provided JSON object. You can implement BooleanSupplier with a class (named or anonymous), lambda or method reference.
Create a file called _factories.json in assets/<modid>/recipes that specifies your IRecipeFactory, IIngredientFactory and IConditionFactory classes.
You can see some examples of custom recipe and ingredient implements here and some examples of the JSON files here.
Ok thanks will try it for at least one thing but, do coded recipes get overridden via resource pack I know the .jsons would
Ok thanks will try it for at least one thing but, do coded recipes get overridden via resource pack I know the .jsons would
Files loaded by the server (e.g. recipes, loot tables and structures) can't be overridden via resource packs, but Mojang plans to add data packs in 1.13 to allow this.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I would like to use a simple method like that without every recipe being an IRecipe interface.
ItemBlocks are registered in the same way as any other Item, just create an instance, set its registry name and register it with IForgeRegistry#register/registerAll.
Calling IForgeRegistry#register for a recipe requires you to create the IRecipe instance yourself. GameRegistry.addShapedRecipe and GameRegistry.addShapelessRecipe still exist, you can use these to add shaped/shapeless recipes in the old way. This should be done in RegistryEvent.Register<IRecipe>.
The whole point of vararg methods is that Java automatically creates the array for you, you don't need to create it yourself.
That said, you should be using the JSON recipe system instead of adding recipes in code.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Sorry I didn't see I commented that again I accidentally commented that twice or three times I was just asking about the recipes.
I remember trying add shaped GameRegistry#addrecipe() and it didn't function the same as GameRegistry#ddShapedRecipe(). Is this still the case? .jsons require actual files when I could register thousands of recipes from code at once If I felt like it without actual files. I could never get the GameRegistry#addShapedRecipe working so I always used addrecipe()
In 1.11.2 and earlier, GameRegistry.addRecipe(ItemStack, Object...) did nothing but call GameRegistry.addShapedRecipe. The two methods did exactly the same thing. GameRegistry.addRecipe(IRecipe) allowed you to add an IRecipe instance that you'd already created yourself.
In 1.12+, both overloads of GameRegistry.addRecipe have been removed; only GameRegistry.addShapedRecipe and GameRegistry.addShapelessRecipe remain. These perform the same function as they did in 1.11.2 and earlier, i.e. creating and registering an instance of ShapedRecipes/ShapelessRecipes from the specified output and input.
You should use the JSON recipe system for every recipe unless there's a specific reason that it wouldn't work (not just a hypothetical "I could register thousands of recipes if I wanted to"). Forge allows you to extend it by adding new condition, recipe and ingredient types; so it's not just limited to simple vanilla-style recipes.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
extend recipes is this an IRecipe Class thing or what? Send me the documentation I will take a look at it.
Again sorry for accidentally asking the same thing at least twice accidentally copied stuff more then once?
I was using "extend" in the general sense here, i.e. "add more stuff". I wasn't specifically talking about extending a class.
There's not much documentation on the JSON recipe system, so I'll briefly explain how to add custom recipe, ingredient and condition types.
To add a custom recipe type, first create a class that either extends an existing IRecipe implementation (e.g. ShapedRecipes) or implements IRecipe and extends IForgeRegistryEntry.Impl. You then create a class that implements IRecipeFactory and deserialises the custom recipe type from the provided JSON object.
To add a custom ingredient type, first create a class extends Ingredient or a subclass (skip this step if an existing Ingredient class provides the required functionality). You then create a class that implements IIngredientFactory and deserialises the custom ingredient type from the provided JSON object.
To add a custom condition type, create a class that implements IConditionFactory and deserialises the condition (a BooleanSupplier) from the provided JSON object. You can implement BooleanSupplier with a class (named or anonymous), lambda or method reference.
Create a file called _factories.json in assets/<modid>/recipes that specifies your IRecipeFactory, IIngredientFactory and IConditionFactory classes.
You can see some examples of custom recipe and ingredient implements here and some examples of the JSON files here.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Ok thanks will try it for at least one thing but, do coded recipes get overridden via resource pack I know the .jsons would
Files loaded by the server (e.g. recipes, loot tables and structures) can't be overridden via resource packs, but Mojang plans to add data packs in 1.13 to allow this.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.