Jump to content

[1.7.10][still Unsloved]Fluid Tank not synced between container and gui


slugslug

Recommended Posts

So i did some testing with print statements and container prints out two values the correct value and then 0.  The gui prints out 0;

 

Here is my container class:

https://github.com/Professorvennie/MachineryCraft/blob/master/src/main/java/com/professorvennie/core/common/containers/ContainerBronzeFurnace.java

 

Here is my gui class:

https://github.com/Professorvennie/MachineryCraft/blob/master/src/main/java/com/professorvennie/core/client/gui/GuiBronzeFurnace.java

 

Here is my tileEntity class:

https://github.com/Professorvennie/MachineryCraft/blob/master/src/main/java/com/professorvennie/core/tileEntity/TileEntityBronzeFurnace.java

 

 

Updated container:

 

 

package com.professorvennie.core.common.containers;

import com.professorvennie.core.tileEntity.TileEntityBronzeFurnace;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;

/**
* Created by ProfessorVennie on 7/23/2014 at 11:38 AM.
*/
public class ContainerBronzeFurnace extends Container{

    private TileEntityBronzeFurnace entity;
    public int lastCookTime, lastTankAmount;

    public ContainerBronzeFurnace(InventoryPlayer inventory, TileEntityBronzeFurnace tileEntityBronzeFurnace) {
        entity = tileEntityBronzeFurnace;

        addSlotToContainer(new Slot(entity, 0, 33, 9 ));
        addSlotToContainer(new Slot(entity, 1, 33, 58 ));
        addSlotToContainer(new Slot(entity, 2, 60, 35 ));
        addSlotToContainer(new SlotFurnace(inventory.player,entity, 3, 120, 35 ));

        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 9; j++){
                this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
            }
        }

        for(int i = 0; i < 9; i++){
            this.addSlotToContainer(new Slot(inventory, i, 8 + i*18, 142));
        }
        System.out.println("Container  " + entity.tank.getFluidAmount());
    }

    public void addCraftingToCrafters(ICrafting icrafting){
        super.addCraftingToCrafters(icrafting);
        icrafting.sendProgressBarUpdate(this, 0, this.entity.cookTime);
        icrafting.sendProgressBarUpdate(this, 1, lastTankAmount);
    }

    public void detectAndSendChanges(){
        super.detectAndSendChanges();

        for(int i = 0; i < this.crafters.size(); i ++){
            ICrafting icrafting = (ICrafting) this.crafters.get(i);

            if(this.lastCookTime != this.entity.cookTime){
                icrafting.sendProgressBarUpdate(this, 0, this.entity.cookTime);
            }

            if(lastTankAmount != entity.tank.getFluidAmount()){
                icrafting.sendProgressBarUpdate(this, 1, entity.tank.getFluidAmount());
            }
        }
        this.lastCookTime = this.entity.cookTime;
        lastTankAmount = entity.tank.getFluidAmount();
    }

    @SideOnly(Side.CLIENT)
    public void updateProgressBar(int slot, int par2){
        super.updateProgressBar(slot, par2);
        if(slot == 0) this.entity.cookTime = par2;
        if(slot == 1){
            if(entity.tank.getFluid() != null)
                entity.tank.getFluid().amount = par2;

        }
    }

    @Override
    public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
        return super.transferStackInSlot(player, slot);
    }

    @Override
    public boolean canInteractWith(EntityPlayer player) {
        return entity.isUseableByPlayer(player);
    }
}

 

 

 

Updated TE:

 

 

package com.professorvennie.core.tileEntity;


import com.professorvennie.core.fuilds.ModFuilds;
import com.professorvennie.core.item.ModItems;
import com.professorvennie.core.lib.Names;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*;

public class TileEntityBronzeFurnace extends TileEntityMod implements ISidedInventory, IFluidHandler {

    public int cookTime = 0, furnaceSpeed = 110;

    private ItemStack[] inventory;

    public FluidTank tank;

    public TileEntityBronzeFurnace(){
        inventory = new ItemStack[4];
        tank = new FluidTank(10000);
    }

    @Override
    public int[] getAccessibleSlotsFromSide(int i) {
        return new int[0];
    }

    @Override
    public boolean canInsertItem(int i, ItemStack itemStack, int i2) {
        return false;
    }

    @Override
    public boolean canExtractItem(int i, ItemStack itemStack, int i2) {
        return false;
    }

    @Override
    public int getSizeInventory() {
        return inventory.length;
    }

    @Override
    public ItemStack getStackInSlot(int slot) {
        return inventory[slot];
    }

    @Override
    public ItemStack decrStackSize(int slot, int amount) {
        if(this.inventory[slot] != null){
            ItemStack itemstack;
            if(this.inventory[slot].stackSize <= amount){
                itemstack = this.inventory[slot];
                this.inventory[slot] = null;
                return itemstack;
            }else{
                itemstack = this.inventory[slot].splitStack(amount);
                if(this.inventory[slot].stackSize == 0){
                    this.inventory[slot] = null;
                }
                return itemstack;
            }
        }
        return null;
    }

    @Override
    public void updateEntity() {
        super.updateEntity();
        boolean flag1 = false;

        if(!worldObj.isRemote){
            if(tank.getFluidAmount() > tank.getCapacity())
                tank.getFluid().amount = tank.getCapacity();

            if(inventory[0] != null) {
                if (inventory[0].getItem() == ModItems.steamBucket) {
                    int temp = tank.getCapacity() - tank.getFluidAmount();
                    if (inventory[1] == null) {
                        if(tank.getFluidAmount() < tank.getCapacity()) {
                            if(temp >= 1000)
                                setInventorySlotContents(1, new ItemStack(Items.bucket));
                        }
                        if(tank.getFluid() == null) {
                            tank.fill(new FluidStack(ModFuilds.fluidSteam, 1000), true);
                        }else if(tank.getFluidAmount() < tank.getCapacity()){
                            if(tank.getFluidAmount() < tank.getCapacity()) {
                                if(temp >= 1000)
                                    tank.getFluid().amount += 1000;
                            }
                        }

                        if(tank.getFluidAmount() < tank.getCapacity()) {
                            if(temp >= 1000) {
                                inventory[0].stackSize--;
                                if (inventory[0].stackSize == 0)
                                    inventory[0] = null;
                            }
                        }

                    } else if(inventory[1].getItem() == Items.bucket){
                        if(tank.getFluidAmount() < tank.getCapacity()) {
                            if(temp >= 1000) {
                                inventory[0].stackSize--;
                                if (inventory[0].stackSize == 0)
                                    inventory[0] = null;
                                inventory[1].stackSize++;
                            }
                        }

                        if(tank.getFluid() == null) {
                            if(temp >= 1000)
                                tank.fill(new FluidStack(ModFuilds.fluidSteam, 1000), true);
                        }else if(tank.getFluidAmount() < tank.getCapacity()){
                            if(temp >= 1000)
                                tank.getFluid().amount += 1000;
                        }
                    }

                }else if (inventory[0].getItem() == Items.bucket) {
                    if(inventory[1] == null){
                        if(tank.getFluidAmount() >= 1000){
                            tank.drain(1000, true);
                            inventory[0].stackSize--;
                            if(inventory[0].stackSize == 0)
                                inventory[0] = null;
                            setInventorySlotContents(1, new ItemStack(ModItems.steamBucket));
                        }
                    }
                }
            }

            if(!canSmelt())
                cookTime = 0;

            if(tank.getFluid() != null) {
                if (tank.getFluid().amount >= 1 && canSmelt()) {
                    cookTime++;
                    if(cookTime > 0) {
                        if(canSmelt())
                            tank.getFluid().amount--;
                    }
                    if (cookTime == furnaceSpeed) {
                        cookTime = 0;
                        smeltItem();
                        flag1 = true;
                    }
                } else
                    cookTime = 0;
            }
        }
        if(flag1) this.markDirty();
    }

    private boolean canSmelt(){
        if(this.inventory[2] == null){
            return false;
        }else{
            ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.inventory[2]);

            if(itemstack == null) return false;
            if(this.inventory[3] == null) return true;
            if(!this.inventory[3].isItemEqual(itemstack)) return false;

            int result = this.inventory[3].stackSize + itemstack.stackSize;

            return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
        }
    }

    private void smeltItem(){
        if(this.canSmelt()){
            ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.inventory[2]);

            if(this.inventory[3] == null){
                this.inventory[3] = itemstack.copy();
            }else if(this.inventory[3].isItemEqual(itemstack)){
                this.inventory[3].stackSize += itemstack.stackSize;
            }

            this.inventory[2].stackSize--;

            if(this.inventory[2].stackSize <= 0){
                this.inventory[2] = null;
            }
        }
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {
        if(this.inventory[slot] != null){
            ItemStack itemstack = this.inventory[slot];
            this.inventory[slot] = null;
            return itemstack;
        }

        return null;
    }

    @Override
    public void setInventorySlotContents(int slot, ItemStack itemStack) {
        this.inventory[slot]= itemStack;

        if(itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()){
            itemStack.stackSize = this.getInventoryStackLimit();
        }
    }

    @Override
    public String getInventoryName() {
        return this.hasCustomName() ? this.getCustomName() : Names.Containers.BRONZE_FURNACE;
    }

    public void readFromNBT(NBTTagCompound nbt){
        super.readFromNBT(nbt);

        NBTTagList list = nbt.getTagList("items", Constants.NBT.TAG_COMPOUND);
        this.inventory = new ItemStack[this.getSizeInventory()];

        for(int i = 0; i < list.tagCount(); i ++){
            NBTTagCompound compound = list.getCompoundTagAt(i);
            int j = compound.getByte("slot") & 0xff;

            if(j >= 0 && j < this.inventory.length){
                this.inventory[j] = ItemStack.loadItemStackFromNBT(compound);

            }
        }
        this.cookTime = (int)nbt.getShort("cookTime");
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);

        nbt.setShort("cookTime", (short) this.cookTime);

        NBTTagList list = new NBTTagList();

        for(int i = 0; i < this.inventory.length; i ++){
            if(this.inventory[i] != null){
                NBTTagCompound compound = new NBTTagCompound();
                compound.setByte("slot", (byte) i);
                this.inventory[i].writeToNBT(compound);
                list.appendTag(compound);
            }
        }
        nbt.setTag("items", list);
    }

    @Override
    public boolean hasCustomInventoryName() {
        return hasCustomName();
    }

    @Override
    public int getInventoryStackLimit() {
        return 64;
    }

    @Override
    public boolean isUseableByPlayer(EntityPlayer player) {
        return true;
    }

    @Override
    public void openInventory() {}

    @Override
    public void closeInventory() {}

    @Override
    public boolean isItemValidForSlot(int i, ItemStack itemStack) {
        return true;
    }

    @Override
    public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
        if(from.equals(ForgeDirection.UP) || from.equals(ForgeDirection.DOWN) || from.equals(ForgeDirection.NORTH) || from.equals(ForgeDirection.SOUTH) || from.equals(ForgeDirection.WEST) || from.equals(ForgeDirection.EAST))
            tank.fill(resource, doFill);
        return 0;
    }

    @Override
    public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
        return drain(from, resource.amount, doDrain);
    }

    @Override
    public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
        return null;
    }

    @Override
    public boolean canFill(ForgeDirection from, Fluid fluid) {
        return true;
    }

    @Override
    public boolean canDrain(ForgeDirection from, Fluid fluid) {
        return true;
    }

    @Override
    public FluidTankInfo[] getTankInfo(ForgeDirection from) {
        return new FluidTankInfo[]{tank.getInfo()};
    }

    public int getCookProgressScaled(int i){
        return cookTime * i / furnaceSpeed;
    }
}

 

 

 

Link to comment
Share on other sites

Oh duh I haven't pushed my latest changes so in my workspace it has. I'll post the new container and tileentity on here.

 

Updated container:

 

 

package com.professorvennie.core.common.containers;

import com.professorvennie.core.tileEntity.TileEntityBronzeFurnace;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
import net.minecraft.item.ItemStack;

/**
* Created by ProfessorVennie on 7/23/2014 at 11:38 AM.
*/
public class ContainerBronzeFurnace extends Container{

    private TileEntityBronzeFurnace entity;
    public int lastCookTime, lastTankAmount;

    public ContainerBronzeFurnace(InventoryPlayer inventory, TileEntityBronzeFurnace tileEntityBronzeFurnace) {
        entity = tileEntityBronzeFurnace;

        addSlotToContainer(new Slot(entity, 0, 33, 9 ));
        addSlotToContainer(new Slot(entity, 1, 33, 58 ));
        addSlotToContainer(new Slot(entity, 2, 60, 35 ));
        addSlotToContainer(new SlotFurnace(inventory.player,entity, 3, 120, 35 ));

        for(int i = 0; i < 3; i++){
            for(int j = 0; j < 9; j++){
                this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
            }
        }

        for(int i = 0; i < 9; i++){
            this.addSlotToContainer(new Slot(inventory, i, 8 + i*18, 142));
        }
        System.out.println("Container  " + entity.tank.getFluidAmount());
    }

    public void addCraftingToCrafters(ICrafting icrafting){
        super.addCraftingToCrafters(icrafting);
        icrafting.sendProgressBarUpdate(this, 0, this.entity.cookTime);
        icrafting.sendProgressBarUpdate(this, 1, lastTankAmount);
    }

    public void detectAndSendChanges(){
        super.detectAndSendChanges();

        for(int i = 0; i < this.crafters.size(); i ++){
            ICrafting icrafting = (ICrafting) this.crafters.get(i);

            if(this.lastCookTime != this.entity.cookTime){
                icrafting.sendProgressBarUpdate(this, 0, this.entity.cookTime);
            }

            if(lastTankAmount != entity.tank.getFluidAmount()){
                icrafting.sendProgressBarUpdate(this, 1, entity.tank.getFluidAmount());
            }
        }
        this.lastCookTime = this.entity.cookTime;
        lastTankAmount = entity.tank.getFluidAmount();
    }

    @SideOnly(Side.CLIENT)
    public void updateProgressBar(int slot, int par2){
        super.updateProgressBar(slot, par2);
        if(slot == 0) this.entity.cookTime = par2;
        if(slot == 1){
            if(entity.tank.getFluid() != null)
                entity.tank.getFluid().amount = par2;

        }
    }

    @Override
    public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
        return super.transferStackInSlot(player, slot);
    }

    @Override
    public boolean canInteractWith(EntityPlayer player) {
        return entity.isUseableByPlayer(player);
    }
}

 

 

 

Updated TE:

 

 

package com.professorvennie.core.tileEntity;


import com.professorvennie.core.fuilds.ModFuilds;
import com.professorvennie.core.item.ModItems;
import com.professorvennie.core.lib.Names;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.*;

public class TileEntityBronzeFurnace extends TileEntityMod implements ISidedInventory, IFluidHandler {

    public int cookTime = 0, furnaceSpeed = 110;

    private ItemStack[] inventory;

    public FluidTank tank;

    public TileEntityBronzeFurnace(){
        inventory = new ItemStack[4];
        tank = new FluidTank(10000);
    }

    @Override
    public int[] getAccessibleSlotsFromSide(int i) {
        return new int[0];
    }

    @Override
    public boolean canInsertItem(int i, ItemStack itemStack, int i2) {
        return false;
    }

    @Override
    public boolean canExtractItem(int i, ItemStack itemStack, int i2) {
        return false;
    }

    @Override
    public int getSizeInventory() {
        return inventory.length;
    }

    @Override
    public ItemStack getStackInSlot(int slot) {
        return inventory[slot];
    }

    @Override
    public ItemStack decrStackSize(int slot, int amount) {
        if(this.inventory[slot] != null){
            ItemStack itemstack;
            if(this.inventory[slot].stackSize <= amount){
                itemstack = this.inventory[slot];
                this.inventory[slot] = null;
                return itemstack;
            }else{
                itemstack = this.inventory[slot].splitStack(amount);
                if(this.inventory[slot].stackSize == 0){
                    this.inventory[slot] = null;
                }
                return itemstack;
            }
        }
        return null;
    }

    @Override
    public void updateEntity() {
        super.updateEntity();
        boolean flag1 = false;

        if(!worldObj.isRemote){
            if(tank.getFluidAmount() > tank.getCapacity())
                tank.getFluid().amount = tank.getCapacity();

            if(inventory[0] != null) {
                if (inventory[0].getItem() == ModItems.steamBucket) {
                    int temp = tank.getCapacity() - tank.getFluidAmount();
                    if (inventory[1] == null) {
                        if(tank.getFluidAmount() < tank.getCapacity()) {
                            if(temp >= 1000)
                                setInventorySlotContents(1, new ItemStack(Items.bucket));
                        }
                        if(tank.getFluid() == null) {
                            tank.fill(new FluidStack(ModFuilds.fluidSteam, 1000), true);
                        }else if(tank.getFluidAmount() < tank.getCapacity()){
                            if(tank.getFluidAmount() < tank.getCapacity()) {
                                if(temp >= 1000)
                                    tank.getFluid().amount += 1000;
                            }
                        }

                        if(tank.getFluidAmount() < tank.getCapacity()) {
                            if(temp >= 1000) {
                                inventory[0].stackSize--;
                                if (inventory[0].stackSize == 0)
                                    inventory[0] = null;
                            }
                        }

                    } else if(inventory[1].getItem() == Items.bucket){
                        if(tank.getFluidAmount() < tank.getCapacity()) {
                            if(temp >= 1000) {
                                inventory[0].stackSize--;
                                if (inventory[0].stackSize == 0)
                                    inventory[0] = null;
                                inventory[1].stackSize++;
                            }
                        }

                        if(tank.getFluid() == null) {
                            if(temp >= 1000)
                                tank.fill(new FluidStack(ModFuilds.fluidSteam, 1000), true);
                        }else if(tank.getFluidAmount() < tank.getCapacity()){
                            if(temp >= 1000)
                                tank.getFluid().amount += 1000;
                        }
                    }

                }else if (inventory[0].getItem() == Items.bucket) {
                    if(inventory[1] == null){
                        if(tank.getFluidAmount() >= 1000){
                            tank.drain(1000, true);
                            inventory[0].stackSize--;
                            if(inventory[0].stackSize == 0)
                                inventory[0] = null;
                            setInventorySlotContents(1, new ItemStack(ModItems.steamBucket));
                        }
                    }
                }
            }

            if(!canSmelt())
                cookTime = 0;

            if(tank.getFluid() != null) {
                if (tank.getFluid().amount >= 1 && canSmelt()) {
                    cookTime++;
                    if(cookTime > 0) {
                        if(canSmelt())
                            tank.getFluid().amount--;
                    }
                    if (cookTime == furnaceSpeed) {
                        cookTime = 0;
                        smeltItem();
                        flag1 = true;
                    }
                } else
                    cookTime = 0;
            }
        }
        if(flag1) this.markDirty();
    }

    private boolean canSmelt(){
        if(this.inventory[2] == null){
            return false;
        }else{
            ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.inventory[2]);

            if(itemstack == null) return false;
            if(this.inventory[3] == null) return true;
            if(!this.inventory[3].isItemEqual(itemstack)) return false;

            int result = this.inventory[3].stackSize + itemstack.stackSize;

            return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
        }
    }

    private void smeltItem(){
        if(this.canSmelt()){
            ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.inventory[2]);

            if(this.inventory[3] == null){
                this.inventory[3] = itemstack.copy();
            }else if(this.inventory[3].isItemEqual(itemstack)){
                this.inventory[3].stackSize += itemstack.stackSize;
            }

            this.inventory[2].stackSize--;

            if(this.inventory[2].stackSize <= 0){
                this.inventory[2] = null;
            }
        }
    }

    @Override
    public ItemStack getStackInSlotOnClosing(int slot) {
        if(this.inventory[slot] != null){
            ItemStack itemstack = this.inventory[slot];
            this.inventory[slot] = null;
            return itemstack;
        }

        return null;
    }

    @Override
    public void setInventorySlotContents(int slot, ItemStack itemStack) {
        this.inventory[slot]= itemStack;

        if(itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()){
            itemStack.stackSize = this.getInventoryStackLimit();
        }
    }

    @Override
    public String getInventoryName() {
        return this.hasCustomName() ? this.getCustomName() : Names.Containers.BRONZE_FURNACE;
    }

    public void readFromNBT(NBTTagCompound nbt){
        super.readFromNBT(nbt);

        NBTTagList list = nbt.getTagList("items", Constants.NBT.TAG_COMPOUND);
        this.inventory = new ItemStack[this.getSizeInventory()];

        for(int i = 0; i < list.tagCount(); i ++){
            NBTTagCompound compound = list.getCompoundTagAt(i);
            int j = compound.getByte("slot") & 0xff;

            if(j >= 0 && j < this.inventory.length){
                this.inventory[j] = ItemStack.loadItemStackFromNBT(compound);

            }
        }
        this.cookTime = (int)nbt.getShort("cookTime");
    }

    @Override
    public void writeToNBT(NBTTagCompound nbt) {
        super.writeToNBT(nbt);

        nbt.setShort("cookTime", (short) this.cookTime);

        NBTTagList list = new NBTTagList();

        for(int i = 0; i < this.inventory.length; i ++){
            if(this.inventory[i] != null){
                NBTTagCompound compound = new NBTTagCompound();
                compound.setByte("slot", (byte) i);
                this.inventory[i].writeToNBT(compound);
                list.appendTag(compound);
            }
        }
        nbt.setTag("items", list);
    }

    @Override
    public boolean hasCustomInventoryName() {
        return hasCustomName();
    }

    @Override
    public int getInventoryStackLimit() {
        return 64;
    }

    @Override
    public boolean isUseableByPlayer(EntityPlayer player) {
        return true;
    }

    @Override
    public void openInventory() {}

    @Override
    public void closeInventory() {}

    @Override
    public boolean isItemValidForSlot(int i, ItemStack itemStack) {
        return true;
    }

    @Override
    public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
        if(from.equals(ForgeDirection.UP) || from.equals(ForgeDirection.DOWN) || from.equals(ForgeDirection.NORTH) || from.equals(ForgeDirection.SOUTH) || from.equals(ForgeDirection.WEST) || from.equals(ForgeDirection.EAST))
            tank.fill(resource, doFill);
        return 0;
    }

    @Override
    public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
        return drain(from, resource.amount, doDrain);
    }

    @Override
    public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
        return null;
    }

    @Override
    public boolean canFill(ForgeDirection from, Fluid fluid) {
        return true;
    }

    @Override
    public boolean canDrain(ForgeDirection from, Fluid fluid) {
        return true;
    }

    @Override
    public FluidTankInfo[] getTankInfo(ForgeDirection from) {
        return new FluidTankInfo[]{tank.getInfo()};
    }

    public int getCookProgressScaled(int i){
        return cookTime * i / furnaceSpeed;
    }
}

 

 

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.