Jump to content

transferStackInSlot causing 0-size stacks


Draco18s

Recommended Posts

This problem only occurs in Slot 2 (the output slot).  Every other slot shift-clicks just fine, but slot 2 likes to leave a size-zero stack behind, for no apparent reason.  I've double checked my code against other Container classes and nothing seems out of place.

 

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotNum) {
        ItemStack itemstack = null;
        Slot slot = (Slot)this.inventorySlots.get(slotNum);

        if (slot != null && slot.getHasStack()) {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();

            if (slotNum > 2) {
                if (RecipeManager.getSiftResult(itemstack1, false) != null) {
                    if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
                        return null;
                    }
                }
                else if (slotNum >= 3 && slotNum < 30) {
                    if (!this.mergeItemStack(itemstack1, 30, 39, false)) {
                        return null;
                    }
                }
                else if (slotNum >= 30 && slotNum < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) {
                    return null;
                }
            }
            else if (!this.mergeItemStack(itemstack1, 3, 39, false)) {
                return null;
            }

            if (itemstack1.stackSize == 0) {
                slot.putStack((ItemStack)null);
            }
            else {
                slot.onSlotChanged();
            }

            if (itemstack1.stackSize == itemstack.stackSize) {
                return null;
            }

            slot.onPickupFromSlot(player, itemstack1);
        }

        return itemstack;
    }

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I can't really tell you why, because I didn't ever tryied myself in transferStackInSlot, but if the stack is correctly moved, you could try it with a

//add in here any Method which checks for a working Recipe or something like that
if(slots[2] != null && !doesRecipesWork()){
slots[2] = null;
}

 

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Link to comment
Share on other sites

Ha, turns out it was my own stupid fault in the TileEntity class:

 

@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
	if(slot == 2) {
		return;
	}

 

Amazing what a night's sleep and fresh eyes will find.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

What the hell did you think there :D

 

No idea! :D

That was written weeks ago, my best-guess is I was thinking "this slot is output, shouldn't be putting anything into it!"

And I had to change the TransferInSlot method last night because it was still a duplicate of the furnace (it was checking furnace recipes for slot validity).  Lots of little stuff that at first blush looks to be working right, but isn't, heh.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Voodoo Spells Caster /SANGOMA / Death & Revenge Spells  +256751735278 Drmama Bonnei , black magic Revenge spells that work overnight or by accident i? Cast these strongest black magic revenge death spells that work fast overnight to kill ex lover, husband, wife girlfriend Enemies overnight without delay. It doesn’t matter whether he or she is in a far location, I guarantee you to have your results you are looking for immediately. Just make sure before you contact me you are committed and you want what you are looking for (Victim Death) because my Revenge spell work fast overnight after casting the spells. Immediately working black magic death spells that work fast will be cast on the person and result is 48hours,24 Hours . How To Cast A Revenge Spell On Someone, Call/ Whats App  Drmama Bonne Revenge Spells That Work Overnight to kill wicked Step-dad/ Step mom Death Revenge Spell on wicked friends, Voodoo Revenge Spells to kill Enemies Black Magic Spells To Harm Someone, Black magic Revenge spells on ex lover Revenge instant Revenge spells on uncle , powerful instant Revenge spells caster, online instant spell that work fast in USA, UK, Kuwait, Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece , Voodoo revenge spell casters spell to make someone sick and die without delay. Germany, Asian, Europe, Philippines, Canada, South Africa, Italy, Peru, India, Iran, Gambia. Sweden, Australia, Nigeria, Spain, Ghana, California, Greece , Voodoo revenge spell casters spell to make someone sick and die without delay. Drmama Bonne +256751735278
    • I made my investment with the wrong platform and ended up losing both my capital investment and the profits I had made through my trade with them over the few months we had partnered together, it was such a very pathetic experience for me as I have never found myself in a situation so critical as this. I became depressed for months and almost lost my mind facing all these scenarios alone. at some point, I was having some suicidal thoughts.. but thanks so much to my therapist who helped me to set and maintain my healthy boundaries, it was she Who also advised me to look for a specialist who could help to recover back my funds from the scammers. that one piece of advice from her did well for me as I had gone online in search of help from experts and I got referred to the Fastfund Recovery and their services. I reached out to their contact detail that were provided by individuals testifying about their good work email ( Fastfundrecovery AT Gmail Dot Com ) and filed a complaint, I was well responded to and we had a deep conversation on how I lost my money to the fake investment platform, everything seems so unbelievable while they assured me of getting everything I have lost, I was asked questions on my mode of payment and evidence that shows a transaction occurred between both parties and if any agreement was breached or stated, after all these, just within the next 48hours or thereabouts I got all my lost investment together with my profits back in my wallet, these guys are amazing. you can get them also on Telegram( at fastfundsrecovery )if you need their help.
    • Etumax Royal Honey Price In Pakistan - Get Free Delivery Shop Today Online With Online Shopping in Pakistan Etumax Royal Honey Available At Our Store Online Shopping in Pakistan, 
    • I want to make a tree decorator that will generate a beehive under branches of my tree. I have no idea how to check for branches and make beehives generate because TreeDecorator.Context.logs() is just a block pos and i dont understand how it works. i hope ill get an answer here.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.