Removed pump for now
This commit is contained in:
parent
733220edef
commit
1c3898bd9e
6 changed files with 0 additions and 638 deletions
|
@ -12,9 +12,7 @@ import resonantinduction.mechanical.belt.TileConveyorBelt;
|
|||
import resonantinduction.mechanical.fluid.pipe.ItemBlockFluidContainer;
|
||||
import resonantinduction.mechanical.fluid.pipe.ItemPipe;
|
||||
import resonantinduction.mechanical.fluid.pump.BlockGrate;
|
||||
import resonantinduction.mechanical.fluid.pump.BlockPump;
|
||||
import resonantinduction.mechanical.fluid.pump.TileGrate;
|
||||
import resonantinduction.mechanical.fluid.pump.TilePump;
|
||||
import resonantinduction.mechanical.fluid.tank.BlockTank;
|
||||
import resonantinduction.mechanical.fluid.tank.TileTank;
|
||||
import resonantinduction.mechanical.gear.ItemGear;
|
||||
|
@ -81,7 +79,6 @@ public class Mechanical
|
|||
public static Block blockTank;
|
||||
public static Block blockReleaseValve;
|
||||
public static Block blockGrate;
|
||||
public static Block blockPump;
|
||||
|
||||
public static Item itemPipe;
|
||||
public static Item itemPipeGuage;
|
||||
|
@ -107,7 +104,6 @@ public class Mechanical
|
|||
|
||||
blockTank = contentRegistry.createBlock(BlockTank.class, ItemBlockFluidContainer.class, TileTank.class);
|
||||
blockGrate = contentRegistry.createTile(BlockGrate.class, TileGrate.class);
|
||||
blockPump = contentRegistry.createTile(BlockPump.class, TilePump.class);
|
||||
|
||||
itemPipeGuage = contentRegistry.createItem(ItemPipeGauge.class);
|
||||
itemPipe = contentRegistry.createItem(ItemPipe.class);
|
||||
|
|
|
@ -1,84 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid.pump;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import resonantinduction.core.prefab.block.BlockRI;
|
||||
import resonantinduction.core.render.RIBlockRenderingHandler;
|
||||
import resonantinduction.mechanical.Mechanical;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockPump extends BlockRI
|
||||
{
|
||||
public BlockPump()
|
||||
{
|
||||
super("pump", Material.iron);
|
||||
this.setHardness(1f);
|
||||
this.setResistance(5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderType()
|
||||
{
|
||||
return RIBlockRenderingHandler.ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int meta)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
|
||||
{
|
||||
return side != ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
TileEntity ent = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
if (meta < 4)
|
||||
{
|
||||
return new ItemStack(Mechanical.blockPump, 1, 0);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TilePump();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
}
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
// Date: 4/15/2013 6:17:44 AM
|
||||
// Template version 1.1
|
||||
// Java generated by Techne
|
||||
// Keep in mind that you still need to fill in some blanks
|
||||
// - ZeuX
|
||||
|
||||
package resonantinduction.mechanical.fluid.pump;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelConstructionPump extends ModelBase
|
||||
{
|
||||
// fields
|
||||
ModelRenderer Side3;
|
||||
ModelRenderer Motor2;
|
||||
ModelRenderer Motor;
|
||||
ModelRenderer side;
|
||||
ModelRenderer base;
|
||||
ModelRenderer side2;
|
||||
ModelRenderer side4;
|
||||
|
||||
public ModelConstructionPump()
|
||||
{
|
||||
textureWidth = 128;
|
||||
textureHeight = 128;
|
||||
|
||||
Side3 = new ModelRenderer(this, 46, 37);
|
||||
Side3.addBox(-5F, 0F, -3F, 10, 11, 5);
|
||||
Side3.setRotationPoint(0F, 10F, -4F);
|
||||
Side3.setTextureSize(64, 32);
|
||||
Side3.mirror = true;
|
||||
setRotation(Side3, 0F, 0F, 0F);
|
||||
Motor2 = new ModelRenderer(this, 10, 23);
|
||||
Motor2.addBox(-4F, -4F, 0F, 8, 8, 4);
|
||||
Motor2.setRotationPoint(0F, 15F, -2F);
|
||||
Motor2.setTextureSize(64, 32);
|
||||
Motor2.mirror = true;
|
||||
setRotation(Motor2, 0F, 0F, 0F);
|
||||
Motor = new ModelRenderer(this, 10, 23);
|
||||
Motor.addBox(-4F, -4F, 0F, 8, 8, 4);
|
||||
Motor.setRotationPoint(0F, 15F, -2F);
|
||||
Motor.setTextureSize(64, 32);
|
||||
Motor.mirror = true;
|
||||
setRotation(Motor, 0F, 0F, 0.7853982F);
|
||||
side = new ModelRenderer(this, 15, 37);
|
||||
side.addBox(-5F, 0F, -3F, 10, 11, 5);
|
||||
side.setRotationPoint(0F, 10F, 5F);
|
||||
side.setTextureSize(64, 32);
|
||||
side.mirror = true;
|
||||
setRotation(side, 0F, 0F, 0F);
|
||||
base = new ModelRenderer(this, 16, 54);
|
||||
base.addBox(-7F, 0F, -8F, 14, 3, 16);
|
||||
base.setRotationPoint(0F, 21F, 0F);
|
||||
base.setTextureSize(64, 32);
|
||||
base.mirror = true;
|
||||
setRotation(base, 0F, 0F, 0F);
|
||||
side2 = new ModelRenderer(this, 0, 37);
|
||||
side2.addBox(-3F, 0F, 2F, 6, 10, 1);
|
||||
side2.setRotationPoint(0F, 11F, 5F);
|
||||
side2.setTextureSize(64, 32);
|
||||
side2.mirror = true;
|
||||
setRotation(side2, 0F, 0F, 0F);
|
||||
side4 = new ModelRenderer(this, 77, 37);
|
||||
side4.addBox(-3F, 0F, -3F, 6, 10, 1);
|
||||
side4.setRotationPoint(0F, 11F, -5F);
|
||||
side4.setTextureSize(64, 32);
|
||||
side4.mirror = true;
|
||||
setRotation(side4, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
public void render(float f5)
|
||||
{
|
||||
Side3.render(f5);
|
||||
side.render(f5);
|
||||
base.render(f5);
|
||||
side2.render(f5);
|
||||
side4.render(f5);
|
||||
}
|
||||
|
||||
public void renderMotor(float f5)
|
||||
{
|
||||
Motor2.render(f5);
|
||||
Motor.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid.pump;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import resonantinduction.core.Reference;
|
||||
import resonantinduction.mechanical.fluid.tank.ModelPump;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderPump extends TileEntitySpecialRenderer
|
||||
{
|
||||
public static final ModelPump MODEL = new ModelPump();
|
||||
public static final ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pump.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity t, double d, double d1, double d2, float f)
|
||||
{
|
||||
int meta = t.getBlockType() != null ? t.getBlockMetadata() : 0;
|
||||
|
||||
bindTexture(TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) d + 0.5F, (float) d1 + 1.5F, (float) d2 + 0.5F);
|
||||
GL11.glScalef(1.0F, -1F, -1F);
|
||||
|
||||
switch (meta)
|
||||
{
|
||||
case 2:
|
||||
GL11.glRotatef(0f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 3:
|
||||
GL11.glRotatef(90f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 0:
|
||||
GL11.glRotatef(180f, 0f, 1f, 0f);
|
||||
break;
|
||||
case 1:
|
||||
GL11.glRotatef(270f, 0f, 1f, 0f);
|
||||
break;
|
||||
}
|
||||
|
||||
MODEL.render(0.0625F);
|
||||
|
||||
if (t instanceof TilePump)
|
||||
{
|
||||
MODEL.renderMotion(0.0625F, ((TilePump) t).rotation);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid.pump;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.fluid.IDrain;
|
||||
import resonantinduction.api.fluid.IFluidPipe;
|
||||
import resonantinduction.core.tilenetwork.ITileConnector;
|
||||
import resonantinduction.mechanical.fluid.network.PipeNetwork;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import universalelectricity.api.vector.VectorHelper;
|
||||
|
||||
import com.builtbroken.common.Pair;
|
||||
|
||||
public class TileConstructionPump extends TilePump implements IFluidHandler, ITileConnector
|
||||
{
|
||||
/* LIQUID FLOW CONNECTION SIDES */
|
||||
/** Internal tank for interaction but not real storage */
|
||||
private FluidTank fakeTank = new FluidTank(FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
||||
List<IDrain> drainsUsed = new ArrayList<IDrain>();
|
||||
|
||||
public TileConstructionPump()
|
||||
{
|
||||
super(50, 50, 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the facing direction
|
||||
*
|
||||
* @param input true for input side, false for output side
|
||||
* @return
|
||||
*/
|
||||
public ForgeDirection getFacing(boolean input)
|
||||
{
|
||||
|
||||
return input ? this.getDirection() : this.getDirection().getOpposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<World, Vector3> getDrainOrigin()
|
||||
{
|
||||
TileEntity inputTile = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), getFacing(true));
|
||||
TileEntity outputTile = VectorHelper.getTileEntityFromSide(worldObj, new Vector3(this), getFacing(false));
|
||||
IDrain drain = this.getNextDrain(inputTile, outputTile, drainsUsed);
|
||||
if (drain == null)
|
||||
{
|
||||
this.drainsUsed.clear();
|
||||
drain = this.getNextDrain(inputTile, outputTile, drainsUsed);
|
||||
}
|
||||
|
||||
if (drain instanceof TileEntity)
|
||||
{
|
||||
this.drainsUsed.add(drain);
|
||||
return new Pair<World, Vector3>(((TileEntity) drain).worldObj, new Vector3(((TileEntity) drain)));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the nextDrain in the list
|
||||
*
|
||||
* @param inputTile - input tile must be an instance of INetworkPipe
|
||||
* @param outputTile - output tile must be an instance of IFluidHandler
|
||||
* @param ignoreList - list of drains to ignore so that the next one is selected
|
||||
* @return the next drain it finds or null if it went threw the entire list. Its suggested to
|
||||
* clear the ignoreList after getting null
|
||||
*/
|
||||
public IDrain getNextDrain(TileEntity inputTile, TileEntity outputTile, List<IDrain> ignoreList)
|
||||
{
|
||||
IDrain drain = null;
|
||||
if (ignoreList == null)
|
||||
{
|
||||
ignoreList = new ArrayList<IDrain>();
|
||||
}
|
||||
|
||||
if (inputTile instanceof IFluidPipe && ((IFluidPipe) inputTile).getNetwork() instanceof PipeNetwork)
|
||||
{
|
||||
if (outputTile instanceof IFluidHandler)
|
||||
{
|
||||
for (IFluidHandler fluidHandler : ((PipeNetwork) ((IFluidPipe) inputTile).getNetwork()).getNodes())
|
||||
{
|
||||
|
||||
if (fluidHandler instanceof IDrain && !ignoreList.contains(fluidHandler))
|
||||
{
|
||||
drain = (IDrain) fluidHandler;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return drain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction)
|
||||
{
|
||||
return direction != getFacing(true) && direction != getFacing(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
TileEntity entity = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), getFacing(false));
|
||||
if (entity instanceof IFluidHandler)
|
||||
{
|
||||
return ((IFluidHandler) entity).fill(getFacing(false).getOpposite(), resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection direction)
|
||||
{
|
||||
if (direction == this.getFacing(false) && this.fakeTank != null)
|
||||
{
|
||||
return new FluidTankInfo[] { new FluidTankInfo(fakeTank.getFluid(), fakeTank.getCapacity()) };
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return from != getFacing(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTileConnect(Connection type, ForgeDirection dir)
|
||||
{
|
||||
TileEntity entity = new Vector3(this).modifyPositionFromSide(dir).getTileEntity(this.worldObj);
|
||||
return entity instanceof IFluidHandler && (dir == this.getFacing(false) || dir == this.getFacing(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
super.invalidate();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,231 +0,0 @@
|
|||
package resonantinduction.mechanical.fluid.pump;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import resonantinduction.api.IReadOut;
|
||||
import resonantinduction.api.fluid.IDrain;
|
||||
import resonantinduction.core.prefab.tile.TileMachine;
|
||||
import resonantinduction.core.tilenetwork.ITileConnector;
|
||||
import universalelectricity.api.energy.EnergyStorageHandler;
|
||||
import universalelectricity.api.vector.Vector3;
|
||||
import calclavia.lib.prefab.tile.IRotatable;
|
||||
import calclavia.lib.utility.FluidUtility;
|
||||
|
||||
import com.builtbroken.common.Pair;
|
||||
|
||||
public class TilePump extends TileMachine implements IReadOut, ITileConnector, IRotatable
|
||||
{
|
||||
private int currentWorldEdits, MAX_WORLD_EDITS_PER_PROCESS;
|
||||
|
||||
public long ENERGY_PER_DRAIN = 50;
|
||||
|
||||
private LiquidPathFinder pathLiquid;
|
||||
private Vector3 lastDrainOrigin;
|
||||
|
||||
public int rotation = 0;
|
||||
|
||||
public TilePump()
|
||||
{
|
||||
this(10, 50, 5);
|
||||
}
|
||||
|
||||
/** @param wattTick - cost in watts per tick to run the tile
|
||||
* @param wattDrain - cost in watts to drain or fill one block
|
||||
* @param maxEdits - max world edits per update (1/2 second) */
|
||||
public TilePump(long wattTick, long wattDrain, int maxEdits)
|
||||
{
|
||||
this.energy = new EnergyStorageHandler((maxEdits * wattDrain) + (wattTick * 20));
|
||||
this.MAX_WORLD_EDITS_PER_PROCESS = maxEdits;
|
||||
this.ENERGY_PER_DRAIN = wattDrain;
|
||||
}
|
||||
|
||||
/** Liquid path finder used by this tile. Retrieve the path finder if using IDrain block */
|
||||
public LiquidPathFinder getLiquidFinder()
|
||||
{
|
||||
if (pathLiquid == null)
|
||||
{
|
||||
pathLiquid = new LiquidPathFinder(this.worldObj, 100, 20);
|
||||
}
|
||||
return pathLiquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
super.updateEntity();
|
||||
|
||||
if (this.ticks % 10 == 0)
|
||||
{
|
||||
this.currentWorldEdits = 0;
|
||||
|
||||
if (this.isFunctioning())
|
||||
{
|
||||
this.rotation = Math.max(Math.min(this.rotation + 1, 7), 0);
|
||||
|
||||
if (!this.worldObj.isRemote)
|
||||
{
|
||||
Pair<World, Vector3> pair = this.getDrainOrigin();
|
||||
if (pair != null && pair.left() != null && pair.right() != null)
|
||||
{
|
||||
this.drainAroundArea(pair.left(), pair.right(), 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Gets the origin the path finder starts on */
|
||||
public Pair<World, Vector3> getDrainOrigin()
|
||||
{
|
||||
// TODO change this to lower by the amount of air between the pump and bottom
|
||||
return new Pair<World, Vector3>(this.worldObj, new Vector3(this).modifyPositionFromSide(ForgeDirection.DOWN));
|
||||
}
|
||||
|
||||
/** Drains an area starting at the given location
|
||||
*
|
||||
* @param world - world to drain in, most cases will be the TileEntities world
|
||||
* @param loc - origin to start the path finder with. If this is an instance of IDrain this
|
||||
* method will act different */
|
||||
public void drainAroundArea(World world, Vector3 vec, int update)
|
||||
{
|
||||
Vector3 origin = vec.clone();
|
||||
if (origin == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Update last drain origin to prevent failed path finding */
|
||||
if (this.lastDrainOrigin == null || !this.lastDrainOrigin.equals(origin))
|
||||
{
|
||||
this.lastDrainOrigin = origin.clone();
|
||||
this.getLiquidFinder().reset();
|
||||
}
|
||||
|
||||
TileEntity drain = vec.clone().getTileEntity(world);
|
||||
TileEntity entity = null;
|
||||
|
||||
Set<Vector3> drainList = null;
|
||||
if (drain instanceof IDrain)
|
||||
{
|
||||
|
||||
origin = vec.modifyPositionFromSide(((IDrain) drain).getDirection());
|
||||
entity = origin.getTileEntity(world);
|
||||
if (entity instanceof IFluidHandler)
|
||||
{
|
||||
FluidStack draStack = ((IFluidHandler) entity).drain(ForgeDirection.UP, MAX_WORLD_EDITS_PER_PROCESS * FluidContainerRegistry.BUCKET_VOLUME, false);
|
||||
|
||||
if (draStack != null && FluidUtility.fillTanksAllSides(worldObj, new Vector3(this), draStack, false, ForgeDirection.DOWN) > 0)
|
||||
{
|
||||
((IFluidHandler) entity).drain(ForgeDirection.UP, FluidUtility.fillTanksAllSides(worldObj, new Vector3(this), draStack, true, ForgeDirection.DOWN), true);
|
||||
|
||||
}
|
||||
return;// TODO check why return is here
|
||||
}
|
||||
}
|
||||
|
||||
if (drainList == null)
|
||||
{
|
||||
if (this.getLiquidFinder().results.size() < MAX_WORLD_EDITS_PER_PROCESS + 10)
|
||||
{
|
||||
this.getLiquidFinder().setWorld(world).refresh().start(origin, MAX_WORLD_EDITS_PER_PROCESS, false);
|
||||
}
|
||||
drainList = this.getLiquidFinder().refresh().results;
|
||||
}
|
||||
|
||||
if (entity == null && drainList != null && drainList.size() > 0)
|
||||
{
|
||||
// System.out.println("StartPump>>DrainArea>>Targets>" +
|
||||
// this.getLiquidFinder().results.size());
|
||||
|
||||
Iterator<Vector3> fluidList = drainList.iterator();
|
||||
|
||||
while (fluidList.hasNext() && this.consumePower(ENERGY_PER_DRAIN, false))
|
||||
{
|
||||
if (this.currentWorldEdits >= MAX_WORLD_EDITS_PER_PROCESS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
Vector3 drainLocation = fluidList.next();
|
||||
FluidStack drainStack = FluidUtility.drainBlock(world, drainLocation, false, 3);
|
||||
// System.out.println("StartPump>>DrainArea>>Draining>>NextFluidBlock>" +
|
||||
// (drainStack == null ? "Null" : drainStack.amount + "mb of " +
|
||||
// drainStack.getFluid().getName()));
|
||||
|
||||
// int fillV = FluidHelper.fillTanksAllSides(worldObj, new Vector3(this),
|
||||
// drainStack, false, ForgeDirection.DOWN);
|
||||
// System.out.println("StartPump>>DrainArea>>Draining>>NextFluidBlock>Filled>" +
|
||||
// fillV + "mb");
|
||||
|
||||
if (drainStack != null && this.fill(drainStack, false) >= drainStack.amount && this.consumePower(ENERGY_PER_DRAIN, true))
|
||||
{
|
||||
// System.out.println("StartPump>>DrainArea>>Draining>>Fluid>" +
|
||||
// drainLocation.toString());
|
||||
/* REMOVE BLOCK */
|
||||
FluidUtility.drainBlock(this.worldObj, drainLocation, true, update);
|
||||
this.fill(drainStack, true);
|
||||
this.currentWorldEdits++;
|
||||
fluidList.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int fill(FluidStack stack, boolean doFill)
|
||||
{
|
||||
return FluidUtility.fillTanksAllSides(worldObj, new Vector3(this), stack, doFill, ForgeDirection.DOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFunction()
|
||||
{
|
||||
return super.canFunction() && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMeterReading(EntityPlayer user, ForgeDirection side, EnumTools tool)
|
||||
{
|
||||
if (tool == EnumTools.PIPE_GUAGE)
|
||||
{
|
||||
return "Source Blocks: " + this.getLiquidFinder().results.size();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnect(ForgeDirection direction)
|
||||
{
|
||||
return direction != ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTileConnect(Connection type, ForgeDirection direction)
|
||||
{
|
||||
return direction != ForgeDirection.DOWN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getDirection()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(ForgeDirection direection)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue