Jump to content

[1.16.5]How could i create a tileentity for my custom furnace?


Recommended Posts

Posted (edited)

I'm trying to create a custom furnace and people suggested me to look at other mods or to look at vanilla minecraft. Unfortunately i can't understand anything in tile entities and i can't figure out what does what, so i'm not able to make my custom furnace, also it would need to have 2 input slots one fuel slot, redstone as a fuel and one output slots, also i would need to know how to create custom recipes for my furnace next. Finally i would need someone to explain me how to do it )= I've been stuck for almost 3 days. 

Edited by zKryle
  • zKryle changed the title to [1.16.5]How could i create a tileentity for my custom furnace?
Posted

Well I tried something but I haven’t created the container or the screen since I’m not sure what to fill some methods in the tile entity with and how to use ItemHandler or the Recipe Handler to make my furnace accept my custom recipes.

Posted
2 hours ago, zKryle said:

Well I tried something but I haven’t created the container or the screen since I’m not sure what to fill some methods in the tile entity with and how to use ItemHandler or the Recipe Handler to make my furnace accept my custom recipes.

a while ago i created an furnace that uses custom recipes
look in here:

and this is my git repo for the furnace
https://github.com/Luis-st/XOres-1.16.1-6.4

  • Thanks 1
Posted
16 minutes ago, zKryle said:

Thanks, but i need to make a custom furnace with 2 inputs )=

okay then look into the minecraft furnace class (tileentity, container, and recipe serializer),
and change the whole thing for your furnace

Posted
3 hours ago, Luis_ST said:

okay then look into the minecraft furnace class (tileentity, container, and recipe serializer),
and change the whole thing for your furnace

Feels a little difficult to understand what i do have to change and the thing in general tho )=

 

Posted
3 hours ago, zKryle said:

Feels a little difficult to understand what i do have to change and the thing in general tho )=

go through the code, understand it, and once you know how the code works, you'll know what to change

 

making the Tile Entity is quite trivial, but making custom recipes can be very annoying, for my implementation of a custom crafting like recipe, I just copy and pasted the vanilla class, and went changing what I needed

1- you'll need a recipe class, that keeps track of what the recipe actually is, and checks if a given inventory has the ingredients to match it. this implements IRecipe, you can then go through the logic of the overrides and add any other method that you may need. the IRecipe is generic, you need to give it the type of your custom inventory (which I'll talk about in step 4)

2- a serializer, that reads json files and creates new instances of your recipe class. this is very boilerplaity, and the best way to learn how to write this is looking at the vanilla code, there are 3 methods you'll need to overwrite, two for packet buffer serialization (this data works kinda like a queue, so you have to make sure you read things in the same order you wrote them). and one for dealing with json deserialization (you can use of JSONUtils from net.minecraft.util, and com.google.gson)

3- and an inventory, to keep the items. this is just a wrapper which extends IInventory, you shouldn't use IInventories for much since the capability system is preferred, but IRecipe requires it.

4- you'll need to register the recipe type through IRecipeType.register, in the RecipeSerializers registration event. and register the recipe serializer (preferrebly through a deferred register)

5- Optional: if you want to generate the recipe files with data generation, you'll have to write a Builder and an IFinishedRecipe which serializes the recipe to a json file

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



×
×
  • Create New...

Important Information

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