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, I'm making a furnace style tileEntity which takes the input of an item and then turns it into another or several other items, all inside a GUI.

 

Everything works perfectly, the input gets consumed and then the outputs are placed on the output slots. But the problem comes along when the user clicks on a empty output slot, somehow making the some of the size of the ItemStacks inside the output itemstacks list become of amount 0 (ItemStack.stackSize becomes 0). I've been looking around the code and can't figure out how is this happening. Even made the output list final and also made a copy of it which is never used and they all turn 0... Here's the relevant part of the code of my tileEntity

 

That the item.uraniumpowder2 turned into a stack size of 0 (0xitem.uraniumpowder2..) in BOTH the listOut and the aux lists! I even checked and the outputList[][] is also changed!

 

So how the heck is this happening?

Is it happening at the point when you click on a slot? Then post the code for your container and/or slot (whole class please) that does the processing of the click.

 

I usually make a custom slot for the output slots, as that can allow flexibility in behavior.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • Author

Well, if you directly take the ItemStack out of the list and pass it around, that ItemStack is still in your List! And if someone modifies it, it will be modified in your List as well, since it's the same ItemStack! Whenever you pass one of them out, copy it (ItemStack has a copy method).

 

Wow it actually was that, using the copy() on the moment I place the item fixed it >.<. Didn't know that the setInventorySlotContents placed the actual stack and not simply its information! Thank you!

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.