Jump to content

[1.8.9] Item that acts as a furnace (container, inventory, gui..., te ?)


Major Squirrel

Recommended Posts

Good evening,

 

Using Forge 1.8.9 build 11.15.1.1722, I'm currently trying to create an item that acts like the furnace when rightclicking on it. (gui texture here) The use case of this item is the following : when rightclicking with this item, a gui is displayed with the player inventory and his hotbar. There are two slots that are unique to the item : an entry slot and an "exit" slot (concretely this is the same as the furnace except that it has two entry slots, the fuel and the things to burn/cook). When putting blocks in the entry slot, it starts the consumption : the consumption may end at any moment like quitting the gui or something else.

 

At first try, I took a look at TheGreyGhost tutorial, BedrockMiner tutorial and coolAlias tutorial : I brained myself when I had to add a TileEntity to an Item which seems to be already set with an ItemStack.

 

Since I don't need to save any data in the Item itself (the consumption is set when the player is using the item, there are no resources to store into slots...), are a Container and an Inventory sufficient to do it ? I ask this question because I'm not sure about storing/updating or not the consumption time, I don't know where to do it. What would be, according to you, the best way to achieve this ?

 

Thank you for your time and your tips !

Squirrel ! Squirrel ! Squirrel !

Link to comment
Share on other sites

Good afternoon,

 

I am bringing you some news. I learnt a lot from coolAlias tutorial and managed to understand some basic Container knowledges such as stacks transfers, slots indexes... I managed to make a nice lil' gui and it works perfectly for now. However, I still don't know how could I implement the consumption part for an Item.

 

I don't need to store data when I close the Item gui : the player can only use the item when he's on it. I would need to store the consumption time, update it every tick and send some data to update the progress bar of the consumption, but all of this seems to be done in the TileEntity (for the furnace) and I don't fully understand how can I accomplish this for an Item.

 

Could you give me some tips ?

 

Following files :

ModContainer.java

ContainerSieve.java

GuiSieve.java

Squirrel ! Squirrel ! Squirrel !

Link to comment
Share on other sites

Hey again,

 

I decided not to use the Item. I definitely wanted to try the block first, and now I'm facing a problem. I don't know which code to trigger on the server side and which one on the client side. Where do I have to register the GuiHandler, client or server ?

 

EDIT: I just read diesieben07 explanation but I don't fully understand it.

Squirrel ! Squirrel ! Squirrel !

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



×
×
  • Create New...

Important Information

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