Jump to content

Dual Input Furnace help


GhostSnyperRecon

Recommended Posts

hi guys, ive created a dual input furnace that works and all, but i cant seem to make the shift-clicking into the right slots to work.

 

here is the code, it will put fuel in the right palce, but only insert an item into one of the input slots. much help appreciated.

 

 

package mod.warp.blocks;

 

import java.util.List;

 

import cpw.mods.fml.common.Side;

import cpw.mods.fml.common.asm.SideOnly;

 

import mod.warp.InfuserRecipes;

import net.minecraft.src.Container;

import net.minecraft.src.EntityPlayer;

import net.minecraft.src.FurnaceRecipes;

import net.minecraft.src.ICrafting;

import net.minecraft.src.InventoryPlayer;

import net.minecraft.src.ItemStack;

import net.minecraft.src.Slot;

import net.minecraft.src.SlotFurnace;

import net.minecraft.src.TileEntityFurnace;

 

// Referenced classes of package net.minecraft.src:

//              Container, Slot, SlotFurnace, InventoryPlayer,

//              ICrafting, TileEntityFurnace, ItemStack, EntityPlayer

 

public class ContainerWarpInfuser extends Container

{

 

private TileEntityWarpInfuser WarpInfuser;

private int CookTime;

private int BurnTime;

private int ItemBurnTime;

 

public ContainerWarpInfuser(InventoryPlayer inventoryplayer, TileEntityWarpInfuser tileentityWarpInfuser)

{

        CookTime = 0;

        BurnTime = 0;

        ItemBurnTime = 0;

        WarpInfuser = tileentityWarpInfuser;

        this.addSlotToContainer(new Slot(tileentityWarpInfuser, 0, 44, 17));

        this.addSlotToContainer(new Slot(tileentityWarpInfuser, 1, 56, 53));

        this.addSlotToContainer(new SlotFurnace(inventoryplayer.player, tileentityWarpInfuser, 2, 116, 35));

        this.addSlotToContainer(new Slot(tileentityWarpInfuser, 3, 67, 17));

        for(int i = 0; i < 3; i++)

        {

                for(int k = 0; k < 9; k++)

                {

                this.addSlotToContainer(new Slot(inventoryplayer, k + i * 9 + 9, 8 + k * 18, 84 + i * 18));

                }

 

        }

 

        for(int j = 0; j < 9; j++)

        {

        this.addSlotToContainer(new Slot(inventoryplayer, j, 8 + j * 18, 142));

        }

 

}

 

public void updateCraftingResults()

{

        super.updateCraftingResults();

        for(int i = 0; i < crafters.size(); i++)

        {

                ICrafting icrafting = (ICrafting)crafters.get(i);

                if(CookTime != WarpInfuser.InfuserCookTime)

                {

                        icrafting.updateCraftingInventoryInfo(this, 0, WarpInfuser.InfuserCookTime);

                }

                if(CookTime != WarpInfuser.InfuserCookTime)

                {

                        icrafting.updateCraftingInventoryInfo(this, 3, WarpInfuser.InfuserCookTime);

                }

                if(BurnTime != WarpInfuser.InfuserBurnTime)

                {

                        icrafting.updateCraftingInventoryInfo(this, 1, WarpInfuser.InfuserBurnTime);

                }

                if(ItemBurnTime != WarpInfuser.currentItemBurnTime)

                {

                        icrafting.updateCraftingInventoryInfo(this, 2, WarpInfuser.currentItemBurnTime);

                }

        }

 

        CookTime = WarpInfuser.InfuserCookTime;

        BurnTime = WarpInfuser.InfuserBurnTime;

        ItemBurnTime = WarpInfuser.currentItemBurnTime;

}

 

@SideOnly(Side.CLIENT)

public void updateProgressBar(int par1, int par2)

{

    if (par1 == 0)

    {

        this.WarpInfuser.InfuserCookTime = par2;

    }

 

    if (par1 == 1)

    {

        this.WarpInfuser.InfuserBurnTime = par2;

    }

 

    if (par1 == 2)

    {

        this.WarpInfuser.currentItemBurnTime = par2;

    }

}

 

public boolean canInteractWith(EntityPlayer entityplayer)

{

        return WarpInfuser.canInteractWith(entityplayer);

}

 

private boolean func_28125_a(ItemStack itemstack1, int i, int j, boolean B) {

// TODO Auto-generated method stub

return false;

}

   

public ItemStack func_82846_b(EntityPlayer par1EntityPlayer, int par2)

    {

        ItemStack var3 = null;

        Slot var4 = (Slot)this.inventorySlots.get(par2);

 

        if (var4 != null && var4.getHasStack())

        {

            ItemStack var5 = var4.getStack();

            var3 = var5.copy();

 

            if (par2 == 2)

            {

                if (!this.mergeItemStack(var5, 3, 39, true))

                {

                    return null;

                }

 

                var4.onSlotChange(var5, var3);

            }

            else if (par2 != 1 && par2 != 0 && par2 != 3)

            {

                if (InfuserRecipes.infusing().getInfusingResult(var5) != null)

                {

                    if (!this.mergeItemStack(var5, 0, 1, false))

                    {

                        return null;

                    }

                   

                    else if (!this.mergeItemStack(var5, 2, 3, false))

                    {

                        return null;

                    }

                }

                else if (TileEntityWarpInfuser.isItemFuel(var5))

                {

                    if (!this.mergeItemStack(var5, 1, 2, false))

                    {

                        return null;

                    }

                }

                else if (par2 >= 3 && par2 < 30)

                {

                    if (!this.mergeItemStack(var5, 30, 39, false))

                    {

                        return null;

                    }

                }

                else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false))

                {

                    return null;

                }

            }

            else if (!this.mergeItemStack(var5, 3, 39, false))

            {

                return null;

            }

 

            if (var5.stackSize == 0)

            {

                var4.putStack((ItemStack)null);

            }

            else

            {

                var4.onSlotChanged();

            }

 

            if (var5.stackSize == var3.stackSize)

            {

                return null;

            }

 

            var4.func_82870_a(par1EntityPlayer, var5);

        }

 

        return var3;

    }

 

}

 

 

Link to comment
Share on other sites

Have you tried changing:

 

else if (!this.mergeItemStack(var5, 2, 3, false))

                    {

                        return null;

                    }

 

to:

 

else if (!this.mergeItemStack(var5, 3, 4, false))

                    {

                        return null;

                    }

 

I am only just touching on creating a new furnace myself but from what I can tell your new input slot is 3 so I imagine that it would look like that. But I'm just guessing.

 

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.