Jump to content

[1.12] How to make Costum Crafting table with costum recipes?


IlTosaerba

Recommended Posts

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 nothingO.o)

Link to comment
Share on other sites

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 nothingO.o)

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

Link to comment
Share on other sites

Go figure! I've done this exact thing!

 

See here and here for the relevant files. Basically, what you have to do is:

  1. 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)
  2. Create the container & gui
  3. Register the slots in the container & the textures in the gui
  4. Setup a GUI handler
  5. Add an right-click action to the block so that it opens the gui
  6. 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)
  7. If you made your own class, create some kind of registry to hold the recipes you want to have, otherwise just use CraftingManager
  8. 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
  9. Voila! Tables!

If you have any specific questions, I'd be willing to help when I've got time.

 

 

 

  • Like 1
  • Thanks 1

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)

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

  1. 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)
  2. Create the container & gui
  3. Register the slots in the container & the textures in the gui
  4. Setup a GUI handler
  5. Add an right-click action to the block so that it opens the gui
  6. 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)
  7. If you made your own class, create some kind of registry to hold the recipes you want to have, otherwise just use CraftingManager
  8. 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
  9. 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)

Link to comment
Share on other sites

@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)

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

3 hours ago, IlTosaerba said:

And the CraftingBlocks class what exatly contain?

CraftingBlocks simply contains the instances of the block objects....

Edited 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)

 

Link to comment
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.
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

    • Hello there! I am trying to make custom dimensions for a modpack I am making in an older minecraft version, 1.16.5. I like that version and it has a few other mods that have not been updated that I would still like to use. Anyway, I am having a terrible time with getting my dimension to work and have tried using code from other peoples projects to at least figure out what I'm supposed to be doing but it has not been as helpful as I would have liked. If anyone could help that would be greatly appreciated! Here is my github with all the code as I am using it: https://github.com/BladeColdsteel/InvigoratedDimensionsMod I have also included the last log, https://pastebin.com/zX9vsDSq, I had when I tried to load up a world, let me know if there is anything else I should send though, thank you!
    • Whether you are a fan of Hypixel Bedwars, SkyWars and PvP gamemodes like that, well you would enjoy this server! We have a very fun and unique style of PvP that a lot of our players really enjoy and we want to bring this server to more players like you! Yes you reading this post haha. Introducing, the Minezone Network, home of SUPER CRAFT BLOCKS. We've been working on this server for over 4 years now. Here is what we have to offer: SUPER CRAFT BLOCKS: This has 3 different gamemodes you can play, Classic, Duels and Frenzy. Each mode offers over 60 kits to choose from, along with a total of over 60 maps, allowing for various different playstyles on each map. There are also random powerups that spawn on the map which can include Health Pots, Bazookas, Nukes, Extra Lives and way way more! There is also double jump in this gamemode as well, which makes PvP a lot more fun & unique. You only need a minimum of 2 players to start any mode! Classic: Choose a kit, 5 lives for each player, fight it out and claim the #1 spot! Look out for lightning as they can spawn powerups to really give you an advantage in the game! Duels: Fight against another random player or one of your friends and see who is the best! Frenzy: Your kit is randomly selected for you, each life you will have a different kit. You can fight with up to 100 players in this mode and lets see who will be the best out of that 100! All the other stuff from Classic/Duels apply to this mode as well like powerups. We have 2 ranks on this server too, VIP and CAPTAIN which has a bunch of different perks for SCB and other things like Cosmetics and more.   SERVER IP: If this server has caught your interest in any way, please consider joining and you will NOT regret it! Bring some of your friends online for an even better experience and join in on the fun at: IP: minezone.club Hope to see you online!   SERVER TRAILER: https://www.youtube.com/watch?v=0phpMgu1mH0
    • The mod give new blocks  
    • I will a Mode for 1.21 in this Mod give new block, items and dimensions   
  • Topics

×
×
  • Create New...

Important Information

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