Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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)

  • 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 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

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.

 

 

 

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)

 

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.

  • 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:

  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)

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

 

  • 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

  • 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?

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)

 

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.