MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a recipe"
-- First, create a custom recipe class that extends the ForgeRecipe class. Then, override the matches and getCraftingResult methods to define your recipe logic. public class CustomRecipe extends ForgeRecipe { public CustomRecipe(ResourceLocation id, String group, ItemStack result, NonNullList<Ingredient> ingredients) { super(id, group, result, ingredients); } @Override public boolean matches(CraftingInventory inv, World world) { // Add your recipe matching logic here } @Override public ItemStack getCraftingResult(CraftingInventory inv) { // Add your recipe result logic here } } -- Next, register your custom recipe serializer in your mod's registry event. public class ModRecipes { public static final DeferredRegister<IRecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, YourMod.MOD_ID); public static final RegistryObject<IRecipeSerializer<?>> CUSTOM_RECIPE = RECIPE_SERIALIZERS.register("custom_recipe", CustomRecipe.Serializer::new); } -- Finally, create a JSON file for your recipe in the 'data/your_mod_id/recipes' folder of your mod's resources. { "type": "your_mod_id:custom_recipe", "group": "your_recipe_group", "ingredients": [ // Add your recipe ingredients here ], "result": { "item": "your_mod_id:your_result_item", "count": 1 } }