Dr.Nickenstein Posted February 1, 2021 Share Posted February 1, 2021 So I was creating a recipe, and now I have no errors in my code. But it still doesn't work for some reason, could you help me find the error? I'll provide my classes: ISculptorRecipe (Recipe interface): https://pastebin.com/rX7c0wJP SculptorRecipe (Recipe class): https://pastebin.com/fkfG41MJ SculptorRecipeSerializer: (Recipe serializer): https://pastebin.com/kNPgSxcC RecipeSerializerInit (Initializator for the serializer): https://pastebin.com/ZdfWNWyC SculptorItemHandler (Item handler for the tile entity): https://pastebin.com/mp2vWqKs pure_flux_crystal.json (Recipe file): https://pastebin.com/8n4uiHFG Thank you in advance. Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 3 minutes ago, diesieben07 said: This bypasses the whole concept of DeferredRegister. You must create your registry entries inside the supplier you give to DeferredRegister#register. You register an IRecipeType twice. Once in RecipeSerializerInit and once in ISculptorRecipe. So it should look like this?: public static final DeferredRegister<IRecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create( ForgeRegistries.RECIPE_SERIALIZERS, Humlands.MOD_ID); public static final RegistryObject<IRecipeSerializer<?>> SCULPTOR_SERIALIZER = RECIPE_SERIALIZERS.register("sculptor", () -> new SculptorRecipeSerializer()); Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 6 minutes ago, diesieben07 said: Yes. Tested it and... doesn't work. Any code I should provide? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 Just now, diesieben07 said: Did you fix the other issue I pointed out as well? If you mean the duplicate recipe type, yes. I have removed the field in the Init. Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted February 1, 2021 Share Posted February 1, 2021 (edited) 8 minutes ago, Dr.Nickenstein said: If you mean the duplicate recipe type, yes. I have removed the field in the Init did you added the registration to your mod class constructor like this: yourClass.RECIPE_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus()); Edited February 1, 2021 by Luis_ST Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 2 minutes ago, Luis_ST said: did you added the registration to your mod class constructor like this: yourClass.RECIPE_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus()); Yes I did. Quote Link to comment Share on other sites More sharing options...
Luis_ST Posted February 1, 2021 Share Posted February 1, 2021 2 minutes ago, Dr.Nickenstein said: Yes I did. did you get an error Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, diesieben07 said: Post updated code, ideally a Git repo. Just now, diesieben07 said: I haven't got a github repository, but I have got github on my desktop. Do I send pastebins or create a git repository? (If so, how?) Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, diesieben07 said: Either works. A git repository is obviously more useful, as we can clone it and try out your code directly. So I created the repository, but it's empty. How do I transfer my code in it? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 30 minutes ago, diesieben07 said: https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/ Sorry for not answering, connection was gone. I'll follow the tutorial and let you know in a bit. Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 51 minutes ago, diesieben07 said: https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/ https://github.com/MrShawshank/Humlands-Reignited Here is my repository. Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, diesieben07 said: Nothing in your code even attempts to process the input item in your inventory. You made some methods in your TileEntity that find the matching recipe, but you never use them. Also, do not create the LazyOptional every time in getCapability, create it once and store it in a field. So what should I do? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 3 minutes ago, diesieben07 said: When the input slot changes, change the output slot. In which method? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 24 minutes ago, diesieben07 said: When the input slot changes, change the output slot. Eerrmmmm... How? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 Just now, Dr.Nickenstein said: Eerrmmmm... How? I've only got the "slot" parameter, which is an int. Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, diesieben07 said: Yes, that tells you which slot changed. But how do I tell it it is the input or the output? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 Just now, diesieben07 said: I mean... you made the inventory. You decide which slot is which. The inventory variable is in the tile entity, not in the item handler Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 Just now, diesieben07 said: What?! Yep, the inventory variable is in the tile entity, and corresponds to the item handler class (SculptorItemHandler) Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 3 minutes ago, diesieben07 said: Yes I know that. How is that relevant? I don't understand how would I do what you said Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 Just now, diesieben07 said: In onContentsChagned you check if the slot that changed is the input slot. If it is, you output the output slot based on the matching recipe. Yes but how do I check if it is the input slot. What number of slot is the input slot? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 2 minutes ago, diesieben07 said: I don't know. Its your inventory. You decide it which slot is which. But I don't have any input or output variables Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, diesieben07 said: What? Like, each slot has an int assigned to it, right? I do not know which it is the input and which is the output Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, diesieben07 said: If you don't know then you need to decide. You made an inventory with two slots. That means you now have slot indices 0 and 1. You are the only person that can decide which is which. Pick one and act accordingly. So I shouldn't create a variable or anything, I just need to keep it in my mind? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, diesieben07 said: You can make constants for it if you want to. Ok so let's say that I know that 0 = input and 1 = output. What should I say in the method? Quote Link to comment Share on other sites More sharing options...
Dr.Nickenstein Posted February 1, 2021 Author Share Posted February 1, 2021 1 minute ago, diesieben07 said: Check if the slot that changed is 0 (input). Then get the matching recipe. Set its output to the output slot. what was the method to get the matching recipe? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.