Skip to content

Commit

Permalink
Expose all fluids to FluidTankInfo[]
Browse files Browse the repository at this point in the history
  • Loading branch information
mDiyo committed Sep 19, 2013
1 parent cbecc93 commit 89c0f2e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 15 deletions.
Binary file removed resources/assets/tinker/textures/gui/googirl.png
Binary file not shown.
34 changes: 19 additions & 15 deletions src/tconstruct/blocks/logic/SmelteryDrainLogic.java
Expand Up @@ -61,7 +61,7 @@ public FluidStack drain (ForgeDirection from, int maxDrain, boolean doDrain)
@Override
public FluidStack drain (ForgeDirection from, FluidStack resource, boolean doDrain)
{
// TODO Auto-generated method stub
// TODO Auto-generated method stub
return null;
}

Expand All @@ -74,28 +74,32 @@ public boolean canFill (ForgeDirection from, Fluid fluid)
@Override
public boolean canDrain (ForgeDirection from, Fluid fluid)
{
// Check that the drain is coming from the from the front of the block
// and that the fluid to be drained is in the smeltery.
boolean containsFluid = fluid == null;
if(fluid!=null){
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
for (FluidStack fstack : smeltery.moltenMetal){
if(fstack.fluidID == fluid.getID()){
containsFluid = true;
break;
}
}
}
// Check that the drain is coming from the from the front of the block
// and that the fluid to be drained is in the smeltery.
boolean containsFluid = fluid == null;
if (fluid != null)
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
for (FluidStack fstack : smeltery.moltenMetal)
{
if (fstack.fluidID == fluid.getID())
{
containsFluid = true;
break;
}
}
}
return from == getForgeDirection() && containsFluid;
}

@Override
public FluidTankInfo[] getTankInfo (ForgeDirection from)
{
if (hasValidMaster() && (from==getForgeDirection() || from == getForgeDirection().getOpposite() || from == ForgeDirection.UNKNOWN))
if (hasValidMaster() && (from == getForgeDirection() || from == getForgeDirection().getOpposite() || from == ForgeDirection.UNKNOWN))
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
return new FluidTankInfo[] { smeltery.getInfo() };
return smeltery.getMultiTankInfo();
//return new FluidTankInfo[] { smeltery.getInfo() };
}
return null;
}
Expand Down
12 changes: 12 additions & 0 deletions src/tconstruct/blocks/logic/SmelteryLogic.java
Expand Up @@ -999,6 +999,18 @@ public FluidTankInfo getInfo ()
{
return new FluidTankInfo(this);
}

public FluidTankInfo[] getMultiTankInfo()
{
FluidTankInfo[] info = new FluidTankInfo[moltenMetal.size() + 1];
for (int i = 0; i < moltenMetal.size(); i++)
{
FluidStack fluid = moltenMetal.get(i);
info[i] = new FluidTankInfo(fluid.copy(), fluid.amount);
}
info[moltenMetal.size()] = new FluidTankInfo(null, maxLiquid - currentLiquid);
return info;
}

/* NBT */

Expand Down

0 comments on commit 89c0f2e

Please sign in to comment.