Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted
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.

Posted

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.

Posted

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

 

Posted
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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I need to know what mod is doing this crash, i mean the mod xenon is doing the crash but i want to know who mod is incompatible with xenon, but please i need to know a solution if i need to replace xenon, i cant use optifine anymore and all the other mods i tried(sodium, lithium, vulkan, etc) doesn't work, it crash the game.
    • I have been trying to solve a consistent crashing issue on my brother's computer where it will crash during the "Scanning Mod Candidates" phase of the loading process that starts when you click the play button on the Minecraft launcher. The issue seems to stem from a missing library that it mentions in the log file I provide below. I might I'm missing the bigger issue here for a smaller one but hopefully someone can find what I'm missing. Here's all of the stuff that I've been able to figure out so far: 1. It has nothing to do with mods, the crash happened with a real modpack, and even when I made a custom modpack and launched it without putting ANY mods into it (That is where the log file comes from by the way). 2. I have tried to find this class like a file in the Minecraft folders, but I've had no luck finding it (I don't think it works like that, but since I really don't understand how it works, I just figured I'd try). 3. I haven't seen anyone else have this issue before. 4. I know that my modpack (with mods) does work since I've run it on my computer, and it works fantastic. For some reason my brother's computer can't seem to run anything through curseforge. 5. This is for Minecraft version 1.20.1, Minecraft launcher version 3.4.50-2.1.3, forge 47.3.0, and curseforge app version 1.256.0.21056 6. My brother is using a Dell laptop from 6 years ago running Windows 10 (If you think more info on this would help, please ask as I do have it. I'm just choosing not to put it here for now). 7. I have reinstalled the curseforge app and installed Minecraft version 1.20.1. I have not reinstalled Minecraft or forge 47.3.0 but I didn't know if that would help. 8. I had an error code of 1 Please let me know if there is anything else that I am missing that you would like me to add to this post/add in a comment! Lastly, many thanks in advance to whoever can help! ------------- LOG FILE (latest.log) ------------- (from /Users/<NAME OF USER>/cursforge/minecraft/Instances/<THE NAME OF MY EMPTY MODPACK>/logs/latest.log) (This was made after running an empty modpack with same versions for all apps) ("[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/hxXvGGEK ------------- DEBUG.LOG (I realized that I should have put this here first after I had done all of the work on putting latest.log in) -------------------- (again, "[REDACTED]" is not the actual text from the log, it is me replacing text I figured wouldn't be necessary for fixing and would hurt my privacy) https://pastebin.com/Fmh8GHYs
    • Pastebin... https://pastebin.com/Y3iZ85L5   Brand new profile, does not point to a mod as far as I can tell, my fatal message just has something about mixins. Don't know much about reading logs like this, but am genuinely stuck, please help. Java updated, pc restarted.
    • I was playing minecraft, forge 47.3.0 and 1.20.1, but when i tried to play minecraft now only crashes, i need help please. here is the crash report: https://securelogger.net/files/e6640a4f-9ed0-4acc-8d06-2e500c77aaaf.txt
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.