Posted July 4, 20214 yr I have a custom tile entity named the Alloy Furnace with 3 input items and 1 output item. For some reason, my recipes aren't working, showing up in the terminal as invalid/unsupported Recipe type. I believe I created the recipe type correctly, but I may be very wrong about that. Please tell me what I've missed, because I can't figure it out. https://github.com/Leronus/mOres/tree/1.16.5 Edited July 4, 20214 yr by Leronus
July 4, 20214 yr Author RecipeTypeInit: package mod.mores.init; import mod.mores.recipe.AlloyFurnaceRecipe; import mod.mores.recipe.IAlloyFurnaceRecipe; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.item.crafting.IRecipeType; import net.minecraft.util.registry.Registry; public class RecipeTypeInit { public static final IRecipeType<IAlloyFurnaceRecipe> ALLOY_TYPE = new RecipeType<>(); public static final IRecipeSerializer<AlloyFurnaceRecipe> ALLOY_SERIALIZER = new AlloyFurnaceRecipe.AlloyRecipeSerializer(); private static class RecipeType<T extends IRecipe<?>> implements IRecipeType<T> { @Override public String toString() { return Registry.RECIPE_TYPE.getKey(this).toString(); } } // end class RecipeType } // end class ModRecipeTypes DataGenerators: @EventBusSubscriber(modid = Mores.MOD_ID, bus = EventBusSubscriber.Bus.MOD) public class DataGenerators { /** * GatherDataEvent handler. * * @param event the GatherDataEvent. */ @SubscribeEvent public static void gatherData(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); if (event.includeServer()) { gen.addProvider(new AlloyFurnaceRecipes(gen)); } } } Main mod class: package mod.mores; import mod.mores.harvestlevel.HarvestCheck; import mod.mores.init.BlockInit; import mod.mores.init.ContainerInit; import mod.mores.init.ItemInit; import mod.mores.init.TileEntityTypeInit; import mod.mores.world.OreGeneration; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.*; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.stream.Collectors; /** * Main class that loads mOres * @author Leronus */ // The value here should match an entry in the META-INF/mods.toml file @Mod("mores") public class Mores { // Directly reference a log4j logger. public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "mores"; public Mores() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); // Register the setup method for modloading bus.addListener(this::setup); // Register the enqueueIMC method for modloading bus.addListener(this::enqueueIMC); // Register the processIMC method for modloading bus.addListener(this::processIMC); // Register the doClientStuff method for modloading bus.addListener(this::doClientStuff); BlockInit.BLOCKS.register(bus); ItemInit.ITEMS.register(bus); ContainerInit.CONTAINER_TYPES.register(bus); TileEntityTypeInit.TILE_ENTITY_TYPES.register(bus); MinecraftForge.EVENT_BUS.register(HarvestCheck.class); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); // Start the ore generation MinecraftForge.EVENT_BUS.addListener(EventPriority.HIGH, OreGeneration::generateOres); } private void setup(final FMLCommonSetupEvent event) { // some preinit code // LOGGER.info("PreInit"); // LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().options); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("mores", "modloaded", () -> { LOGGER.info("Intermod queue event"); return "Mores ready to talk";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("Server has started"); } }
July 4, 20214 yr Author The recipes are located in Mores\mOres_1.16.5\src\main\resources\data\mores\recipes\alloy_furnace Example of a recipe I'm using (bronze_ingot.json): { "conditions": [ { "modid": "mores", "type": "forge:mod_loaded" } ], "type": "mores:alloying", "process_time": 300, "ingredients": [ { "item": "mores:copper_ingot" }, { "item": "mores:tin_ingot" }, { "item": "minecraft:bone_meal" } ], "result": { "item": "mores:bronze_ingot", "count": 1 } }
July 4, 20214 yr Author 4 minutes ago, diesieben07 said: Sorry, do you really expect to be able to just dump three posts worth of in here and people just magically figure this out? Unfortunately that does not work. Please post a git repo so we can debug this. Aight, my bad https://github.com/Leronus/mOres/tree/1.16.5
July 5, 20214 yr Author 4 hours ago, diesieben07 said: IRecipeSerializer is a registry entry. You must register it in the same way you do blocks and items. Thanks.
July 5, 20214 yr Author I'm now getting this JSON Syntax error [14:35:52] [Render thread/ERROR] [minecraft/RecipeManager]: Parsing error loading recipe mores:alloy_furnace/steel_ingot com.google.gson.JsonSyntaxException: Missing output, expected to find a JsonObject at net.minecraft.util.JSONUtils.getAsJsonObject(JSONUtils.java:203) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at mod.mores.recipe.AlloyFurnaceRecipe$AlloyRecipeSerializer.fromJson(AlloyFurnaceRecipe.java:203) ~[main/:?] {re:classloading} at mod.mores.recipe.AlloyFurnaceRecipe$AlloyRecipeSerializer.fromJson(AlloyFurnaceRecipe.java:196) ~[main/:?] {re:classloading} at net.minecraft.item.crafting.RecipeManager.fromJson(RecipeManager.java:141) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.item.crafting.RecipeManager.apply(RecipeManager.java:61) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.item.crafting.RecipeManager.apply(RecipeManager.java:38) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.client.resources.ReloadListener.lambda$reload$1(ReloadListener.java:14) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniAccept.tryFire$$$capture(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478) ~[?:?] {} at net.minecraft.resources.AsyncReloader.lambda$null$3(AsyncReloader.java:66) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.doRunTask(ThreadTaskExecutor.java:136) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.RecursiveEventLoop.doRunTask(RecursiveEventLoop.java:22) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading} at net.minecraft.util.concurrent.ThreadTaskExecutor.pollTask(ThreadTaskExecutor.java:109) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.util.concurrent.ThreadTaskExecutor.managedBlock(ThreadTaskExecutor.java:119) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.Minecraft.makeServerStem(Minecraft.java:1863) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.loadWorld(Minecraft.java:1712) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.loadLevel(Minecraft.java:1681) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screen.WorldSelectionList$Entry.loadWorld(WorldSelectionList.java:364) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screen.WorldSelectionList$Entry.joinWorld(WorldSelectionList.java:273) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screen.WorldSelectionList$Entry.mouseClicked(WorldSelectionList.java:225) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.widget.list.AbstractList.mouseClicked(AbstractList.java:309) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.INestedGuiEventHandler.mouseClicked(INestedGuiEventHandler.java:28) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHelper.lambda$onPress$0(MouseHelper.java:87) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.gui.screen.Screen.wrapScreenError(Screen.java:427) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHelper.onPress(MouseHelper.java:85) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.MouseHelper.lambda$null$4(MouseHelper.java:175) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.util.concurrent.ThreadTaskExecutor.execute(ThreadTaskExecutor.java:86) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.client.MouseHelper.lambda$setup$5(MouseHelper.java:174) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:36) ~[lwjgl-glfw-3.2.2.jar:build 10] {} at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.2.2.jar:build 10] {} at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3174) ~[lwjgl-glfw-3.2.2.jar:build 10] {} at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:112) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:999) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:607) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:184) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:567) ~[?:?] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:52) ~[forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [forge-1.16.5-36.1.0_mapped_official_1.16.5-recomp.jar:?] {} Why am I getting this error?
July 5, 20214 yr Author 1 hour ago, diesieben07 said: Your serializer is looking for a JsonObject called "output" in the recipe. this key does not exist in your JSON file. Thanks, I've updated the recipes accordingly. Still the recipes do not seem to work. Any idea what I'm doing wrong?
July 6, 20214 yr Author 10 hours ago, diesieben07 said: Your recipe handling code is very strange. You first copy your items into an Inventory, so that you have an IInventory. You then wrap that inventory back into an IItemHandler (using InvWrapper) only to then convert it back into an IInventory using RecipeWrapper. Why on earth are you doing this? Just use RecipeWrapper on your actual IItemHandler. What is the point of AbstractAlloyFurnaceTileEntity#isInput / AlloyFurnaceRecipe.isInput (and the same for catalyst)? Your recipe already checks whether it is a valid item, why is this additional check necessary? Additionally, the initLegalisms method is utterly broken as it does not invalidate when recipes are reloaded or anything like that. Why do you have it? If you really needed this functionality somewhere else (outside of the TE's recipe check, because there it doesn't make sense) then you could just check the recipe on the fly. Additionally the checks are broken because ItemStack does not override equals and hashCode and as such cannot be used in a traditional way in a HashSet. I don't understand, how do I use RecipeWrapper on the actual IItemHandler and how do I fix these broken checks?
July 6, 20214 yr Author 6 hours ago, diesieben07 said: First you get the two inputs and the catalyst. You then pass these three stacks to the getResult method. The getResult method then does this: new RecipeWrapper(new InvWrapper(new Inventory(input1, input2, catalyst))) Instead, getResult could just get passed in the IItemHandler you already have (here) and use RecipeWrapper on that. Thanks a lot for explaining it this way! I've updated the code and everything works like a charm now.
July 6, 20214 yr Author I still have one issue; When I remove the catalyst or the fuel, the TileEntity will remain in its LIT state. How do I solve this? Scratch that, it seems to work actually. Edited July 6, 20214 yr by Leronus
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.