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 everyone, I was looking at the tutorials on the wiki and I saw the one for Containers and GUIs, I implemented it, it works great but there's a little problem, when I do the shift + click stuff it doubles my item, I tried to look at a lot of different sources, implemented it a lot of times and it still doubles my items, what could I do?

 

The problem is when transfering from the tile entity's inventory to the player inventory.

  • Author

Well, the code is the exact same, copy paste... A few names changed but that's it. When I say that my code is the same as it is there then it is (6 years of java). I tried to get it from a lot of other sources, all of them did the same.

 

Container: http://pastebin.com/u7XMwF2K (It's an exact copy with the names changed)

TE: http://pastebin.com/Wfesgiy7 (Exact copy with changed names)

 

The block, do you really need that?

    public ItemStack decrStackSize(int par1, int par2)
    {
        if (this.furnaceItemStacks[par1] != null)
        {
            ItemStack itemstack;

            if (this.furnaceItemStacks[par1].stackSize <= par2)
            {
                itemstack = this.furnaceItemStacks[par1];
                this.furnaceItemStacks[par1] = null;
                return itemstack;
            }
            else
            {
                itemstack = this.furnaceItemStacks[par1].splitStack(par2);

                if (this.furnaceItemStacks[par1].stackSize == 0)
                {
                    this.furnaceItemStacks[par1] = null;
                }

                return itemstack;
            }
        }
        else
        {
            return null;
        }
    }

 

Im not sure why you didnt just use the furnace tile entity as reference... The above is from the furnace.

  • Author

Soo...what is the problem? decrStackSize? Why would that be a problem in a chest Well, I'll try that when I get back home.

  • Author

As I said, the problem is when shift clicking from the tile entity to the player inventory, that decrement stack size function from the furnance didn't change anything

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.