Jump to content

Recommended Posts

Posted

@Override
    public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
        if(slotId == 9) {
            ItemStack result = tileentity.getStackInSlot(9);
            if(result.getItem() != Items.AIR) {
                for(int x = 0; x < 9; x++) {
                    ItemStack stack = tileentity.getStackInSlot(x);
                    if(stack.getCount() > 0 && stack.getItem() != Items.AIR) {
                        stack.setCount(stack.getCount()-1);
                    }
                }
                   
                        
                player.dropItem(result.splitStack(1), true);
                return super.slotClick(slotId, dragType, clickTypeIn, player);
            }
        }
        
        
        
        
        return super.slotClick(slotId, dragType, clickTypeIn, player);
    }

 

that line i marked is not that i want, is it possible to set instead ot that the item stack in the drag slot?

Posted (edited)
 stack.setCount(stack.getCount()-1);

use stack.srink(1)

 

(stack.getCount() > 0 && stack.getItem() != Items.AIR)
result.getItem() != Items.AIR

use !stack.isEmpty()

 

30 minutes ago, Schleim_time said:

that line i marked is not that i want, is it possible to set instead ot that the item stack in the drag slot? 

what do you want ??

Edited by loordgek

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.