Jump to content

Double Furnace: transferStackInSlot


Zcelo12

Recommended Posts

Hello,

I currently using Forge latest recommend build for 1.7.2.

 

I'm trying to modify the function for transferStackInSlot.

My problem is, that my second input doesn't transfered.

 

I modified the vanilla code from the furnace. The second output works correctly, so if i shift click on the outputs they will be transfered in my inventory.

 

public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
        {
            ItemStack itemstack = null;
            Slot slot = (Slot)this.inventorySlots.get(par2);

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

                if (par2 == 2 || par2 == 4)
                {
                    if (!this.mergeItemStack(itemstack1, 3, 39, true))
                    {
                        return null;
                    }

                    slot.onSlotChange(itemstack1, itemstack);
                }
                
                else if (par2 != 1 && par2 != 0)
                {
                    if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null)
                    {
                        if (!this.mergeItemStack(itemstack1, 0, 1, false))
                        {
                            return null;
                        }
                    }
                    else if (TileEntityFurnace.isItemFuel(itemstack1))
                    {
                        if (!this.mergeItemStack(itemstack1, 1, 2, false))
                        {
                            return null;
                        }
                    }
                    else if (par2 >= 3 && par2 < 30)
                    {
                        if (!this.mergeItemStack(itemstack1, 30, 39, false))
                        {
                            return null;
                        }
                    }
                    else if (par2 >= 30 && par2 < 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(par1EntityPlayer, itemstack1);
            }

            return itemstack;
        }

 

Ouh and my Slots

        public containerFurnace(InventoryPlayer par1InventoryPlayer, FE_TileEntityFurnace par2TileEntityLargeFurnace)
        {
        		this.telf = par2TileEntityLargeFurnace;
                this.addSlotToContainer(new Slot(par2TileEntityLargeFurnace, 0, 52, 15));
                this.addSlotToContainer(new Slot(par2TileEntityLargeFurnace, 1, 52, 57));
                this.addSlotToContainer(new My_SlotFurnace(par1InventoryPlayer.player, par2TileEntityLargeFurnace, 2, 108, 15));
                this.addSlotToContainer(new Slot(par2TileEntityLargeFurnace, 3, 52, 33));
                this.addSlotToContainer(new My_SlotFurnace(par1InventoryPlayer.player, par2TileEntityLargeFurnace, 4, 108, 33));
                for(int i = 0; i < 3; i++)
                {
                        for(int k = 0; k < 9; k++)
                        {
                         this.addSlotToContainer(new Slot(par1InventoryPlayer, k + i * 9 + 9, 8 + k * 18, 84 + i * 18));
                        }
                }
                for(int j = 0; j < 9; j++)
                {
                 this.addSlotToContainer(new Slot(par1InventoryPlayer, j, 8 + j * 18, 142));
                }
        }

 

These funtions are in my container.class

 

Inputs are 0 and 3

Fuel is 1

Outputs are 2 and 4

 

Hope you could help me.

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.