Posted July 28, 20178 yr Hello modder! I'm trying to do a mod, and I need to create a block similar to the crafting table, but with costum recipes. How exatly can I do this? (I try to read the original files and classes for the crafting table... but it's very complicate and I don't understand nothing)
July 28, 20178 yr I'm not sure, but you can add some class in your custom container that add custom recipe by testing slots with a list of recipes.
July 28, 20178 yr Author 13 minutes ago, IlTosaerba said: Hello modder! I'm trying to do a mod, and I need to create a block similar to the crafting table, but with costum recipes. How exatly can I do this? (I try to read the original files and classes for the crafting table... but it's very complicate and I don't understand nothing) UPDATE Here's the files I have where the block appear: src/main/java/com/WLLC/<myMod>/Reference.java : https://pastebin.com/M7p0GnrZ src/main/java/com/WLLC/<myMid/blocks/BlockRaffineria.java: https://pastebin.com/wT0FD44C src/main/java/init/ModBlocks.java: https://pastebin.com/80Hr2iST src/main/resources/assets/<myModID>/blockstates/blockraffineria.json: https://pastebin.com/NZaWJgDf src/main/resources/assets/<myModID>/models/block/raffineria.json: https://pastebin.com/2pRCaxzr src/main/resources/assets/<myModID>/models/item/blockraffineria.json : https://pastebin.com/me4iQXW0
July 28, 20178 yr Go figure! I've done this exact thing! See here and here for the relevant files. Basically, what you have to do is: Create the block (if you want to store the items in the block after a player has quit, you will need a TileEntity - normal crafting table & my crafting table do not do this) Create the container & gui Register the slots in the container & the textures in the gui Setup a GUI handler Add an right-click action to the block so that it opens the gui Create a custom recipe class or use minecraft's IRecipe (I created my own so it could access the player doing the crafting - this is probably not necessary, but it depends on what you're doing) If you made your own class, create some kind of registry to hold the recipes you want to have, otherwise just use CraftingManager Add checks in the crafting slot / container to see if the recipe is matched, and if it is, get the result and clear the table Voila! Tables! If you have any specific questions, I'd be willing to help when I've got time. Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
July 28, 20178 yr It's a little bit hard for me, I'm sorry. But it seems that the game use 3 inventory(for the workbench) : - the inventory of the player. -the workbench matrix(recipe) -the workbench craft result When you click on the block the game should open the gui and a container with the 3 inventory. And then create your custom recipe class using IRecipe.
July 28, 20178 yr Author 2 hours ago, Socratic_Phoenix said: Go figure! I've done this exact thing! See here and here for the relevant files. Basically, what you have to do is: Create the block (if you want to store the items in the block after a player has quit, you will need a TileEntity - normal crafting table & my crafting table do not do this) Create the container & gui Register the slots in the container & the textures in the gui Setup a GUI handler Add an right-click action to the block so that it opens the gui Create a custom recipe class or use minecraft's IRecipe (I created my own so it could access the player doing the crafting - this is probably not necessary, but it depends on what you're doing) If you made your own class, create some kind of registry to hold the recipes you want to have, otherwise just use CraftingManager Add checks in the crafting slot / container to see if the recipe is matched, and if it is, get the result and clear the table Voila! Tables! If you have any specific questions, I'd be willing to help when I've got time. Thanks but I can't apply your method 'cause u use a lot of class which I haven't. So if I try to copy ur code it will never work 'cause I haven't all class (for example Tome class and Keys class and others)
July 28, 20178 yr @IlTosaerba You're not supposed to copy the code... your supposed to look at the code and ask questions if you need help, I'm just providing another example. The Keys class just stores some constants, and the Tome class isn't at all connected to the crafting table... Use the example to write your own classes. Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
July 29, 20178 yr Author 18 hours ago, Socratic_Phoenix said: @IlTosaerba You're not supposed to copy the code... your supposed to look at the code and ask questions if you need help, I'm just providing another example. The Keys class just stores some constants, and the Tome class isn't at all connected to the crafting table... Use the example to write your own classes. Allright, I'll try hoping it will work
July 29, 20178 yr Author 18 hours ago, Socratic_Phoenix said: @IlTosaerba You're not supposed to copy the code... your supposed to look at the code and ask questions if you need help, I'm just providing another example. The Keys class just stores some constants, and the Tome class isn't at all connected to the crafting table... Use the example to write your own classes. And the CraftingBlocks class what exatly contain?
July 29, 20178 yr 3 hours ago, IlTosaerba said: And the CraftingBlocks class what exatly contain? CraftingBlocks simply contains the instances of the block objects.... Edited July 29, 20178 yr by Socratic_Phoenix Developer of Randores (adds 256^3 ores to the game) and Arcane Bags (adds ridiculous storage with ridiculous crafting recipes). I know Java pretty well... So yeah... Quote This is where I'd put an inspirational and/or clever quote, but I can't think of one right now... This is the output of the totally, 100% working compiler for my programming language, Planet9: Beginning Compilation... Failed compilation! planet9.compiler.error.CompilationException: Compiler not yet implemented at planet9.compiler.Compiler.compile(Compiler.java:39) at planet9.compiler.app.CompilerApp.main(CompilerApp.java:147)
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.