Fixed gutters drain source blocks, includes preventing drain blocks when only filling 1mb

This commit is contained in:
Robert S 2014-03-21 00:39:20 -04:00
parent e57004a6fd
commit b4e46d7104

View file

@ -42,12 +42,9 @@ import calclavia.lib.utility.inventory.InventoryUtility;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* The gutter, used for fluid transfer.
/** The gutter, used for fluid transfer.
*
* @author Calclavia
*
*/
* @author Calclavia */
public class TileGutter extends TilePressureNode
{
public TileGutter()
@ -105,6 +102,27 @@ public class TileGutter extends TilePressureNode
};
}
@Override
public void updateEntity()
{
super.updateEntity();
if (!this.world().isRemote && this.ticks % 5 == 0)
{
/** Drain block above if it is a fluid. */
Vector3 drainPos = new Vector3(this).translate(0, 1, 0);
FluidStack drain = FluidUtility.drainBlock(worldObj, drainPos, false);
if (drain != null)
{
if (fill(ForgeDirection.UP, drain, false) >= drain.amount)
{
fill(ForgeDirection.UP, drain, true);
FluidUtility.drainBlock(worldObj, drainPos, true);
}
}
}
}
@Override
public Iterable<Cuboid> getCollisionBoxes()
{
@ -183,9 +201,7 @@ public class TileGutter extends TilePressureNode
{
if (player.getCurrentEquippedItem() != null)
{
/**
* Manually wash dust into refined dust.
*/
/** Manually wash dust into refined dust. */
ItemStack itemStack = player.getCurrentEquippedItem();
RecipeResource[] outputs = MachineRecipes.INSTANCE.getOutput(RecipeType.MIXER.name(), itemStack);
@ -260,29 +276,7 @@ public class TileGutter extends TilePressureNode
{
if (!world().isRemote)
{
fill(ForgeDirection.UNKNOWN, new FluidStack(FluidRegistry.WATER, 10), true);
}
}
@Override
protected void onWorldJoin()
{
onNeighborChanged();
}
@Override
public void onNeighborChanged()
{
/**
* Drain block above if it is a fluid.
*/
Vector3 drainPos = new Vector3(this).translate(0, 1, 0);
FluidStack drain = FluidUtility.drainBlock(worldObj, drainPos, false);
if (drain != null)
{
if (fill(ForgeDirection.UP, drain, true) > 0)
FluidUtility.drainBlock(worldObj, drainPos, true);
fill(ForgeDirection.UP, new FluidStack(FluidRegistry.WATER, 10), true);
}
}
@ -389,17 +383,13 @@ public class TileGutter extends TilePressureNode
if (!WorldUtility.isEnabledSide(sides, dir))
{
/**
* Render sides
*/
/** Render sides */
MODEL.renderOnly("left");
}
if (!WorldUtility.isEnabledSide(sides, dir) || !WorldUtility.isEnabledSide(sides, dir.getRotation(ForgeDirection.UP)))
{
/**
* Render strips
*/
/** Render strips */
MODEL.renderOnly("backCornerL");
}
GL11.glPopMatrix();