Jump to content

[1.6.4] Shift + click doubles my items


andreidim

Recommended Posts

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

    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.

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.