Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2] Custom Furnace Recipe With No Output


Recommended Posts

I finally got the Forge MDK for 1.15.2 to install properly on my computer after months of frustration, so yay for that! But I haven't modded since 1.12, and man, things have changed. So I'm going to need some help from the community...

 

I would like to create a furnace recipe that has no output. You put the item (probably will be redstone dust) in the input of a furnace with fuel, and it burns away, but leaves no output. (There will be tile entity things happening that will make this worthwhile.) Turns out, the vanilla recipe manager can't handle this: creating a recipe with the result being minecraft:air just doesn't work at all. So it seems like I'll have to create a custom recipe type... but wow, it's very different than 1.12! I can't seem to find any tutorials on it. It seems like the _factories.json is completely gone, and now there's some kind of three-part system, with recipes, serializers, and factories all being required for this? The Forge documentation seems out of date, still showing the _factories.json approach.

 

I tried looking through some of the vanilla recipe serializers and using the blasting recipe class/serializer as a base for my own, but it's not working. I have this as my recipe class:

 

package com.icemetalpunk.scarlet_alchemy.recipes;

import com.icemetalpunk.scarlet_alchemy.ScarletAlchemy;

import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.AbstractCookingRecipe;
import net.minecraft.item.crafting.CookingRecipeSerializer;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;

public class VaporizingRecipe extends AbstractCookingRecipe {
	static ResourceLocation RES_LOC = new ResourceLocation(ScarletAlchemy.MOD_ID, "vaporizing");
	static IRecipeType<VaporizingRecipe> VAPORIZING_RECIPE_TYPE = IRecipeType.register("vaporizing");
	static CookingRecipeSerializer<VaporizingRecipe> SERIALIZER = IRecipeSerializer.register("vaporizing",
			new CookingRecipeSerializer<VaporizingRecipe>(VaporizingRecipe::new, 100));

	public VaporizingRecipe(ResourceLocation idIn, String groupIn, Ingredient ingredientIn, ItemStack resultIn,
			float experienceIn, int cookTimeIn) {
		super(VAPORIZING_RECIPE_TYPE, RES_LOC, groupIn, ingredientIn, new ItemStack(Items.AIR, 0), experienceIn,
				cookTimeIn);
	}

	@Override
	public IRecipeSerializer<?> getSerializer() {
		return SERIALIZER;
	}
}

 

But Eclipse shows the error: "The type CookingRecipeSerializer<T>.IFactory<VaporizingRecipe> from the descriptor computed for the target context is not visible here."

 

How exactly am I supposed to define a serializer based on the cooking recipe serializer? Do I actually need to create an entirely new class that copies all the code from CookingRecipeSerializer but which exposes its IFactory? The fields it uses are private, so I can't even extend it properly... There must be a cleaner way that I don't know about, right?

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to post
Share on other sites

I think you're going to need to extend the FurnaceRecipe class, not the abstract class.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
Share on other sites
12 hours ago, Draco18s said:

I think you're going to need to extend the FurnaceRecipe class, not the abstract class.

Even if I do that, I still have the same errors trying to create the serializer for it. Still says the IFactory type is not visible (although parametrized with FuranceRecipe instead of AbstractCookingRecipe now, but the same error otherwise).

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to post
Share on other sites

Oh! Hmm.

Nope, not sure what's going on.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to post
Share on other sites

I haven't done anything with cooking recipes specifically, but all vanilla recipe serializers are now Forge registry objects.  So registering your own serializer is now done like any other registry object - either via RegistryEvent.Register<CookingRecipeSerializer> and @ObjectHolder, or (preferably) using the new deferred registry system.

 

So it should (like I said, I haven't tried this with cooking recipes, only crafting recipes) be possible to register your custom cooking recipes with a registry name of (say) "mymod:my_recipe", and then have a recipe JSON in your data/recipes looking like:

{
  "type": "mymod:my_recipe"
}

 

For an example of how I register custom crafting recipes, see https://github.com/TeamPneumatic/pnc-repressurized/blob/1.14/src/main/java/me/desht/pneumaticcraft/common/core/ModRecipes.java

 

Link to post
Share on other sites
16 hours ago, desht said:

I haven't done anything with cooking recipes specifically, but all vanilla recipe serializers are now Forge registry objects.  So registering your own serializer is now done like any other registry object - either via RegistryEvent.Register<CookingRecipeSerializer> and @ObjectHolder, or (preferably) using the new deferred registry system.

 

So it should (like I said, I haven't tried this with cooking recipes, only crafting recipes) be possible to register your custom cooking recipes with a registry name of (say) "mymod:my_recipe", and then have a recipe JSON in your data/recipes looking like:


{
  "type": "mymod:my_recipe"
}

 

For an example of how I register custom crafting recipes, see https://github.com/TeamPneumatic/pnc-repressurized/blob/1.14/src/main/java/me/desht/pneumaticcraft/common/core/ModRecipes.java

 

Unfortunately, I'm not even to the point of registering the serializer yet. I'm getting these errors from Eclipse right in the IDE, long before I even run anything, as soon as I type the code :(

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to post
Share on other sites

Yeah, I think you're right that CookingRecipeSerializer.IFactory needs to be public to be able to extend it in any useful way.  I'd say a PR to Forge is needed there (just an AT entry to make IFactory public, so pretty simple).

 

You do need to move away from statically creating your recipe type and serializer objects, though, same as for any other registry object.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.