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.

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

Featured Replies

Posted

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 !

you can store everything you need in the itemstacks nbt.

I would save the time the "furnace" got opened last time in the nbt, and whenever the player opens the inventory process the items for actualTime-lastTimeOpened ticks

  • Author

That's the trick : when the player quits the item interface, it stops the consumption. The items which were in the slots are dropped on the floor.

Squirrel ! Squirrel ! Squirrel !

  • Author

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 !

  • Author

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 !

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.