fix fluid dupe with the pump robot
This commit is contained in:
parent
180a020fc7
commit
3e859b38d9
1 changed files with 6 additions and 14 deletions
|
@ -9,14 +9,11 @@
|
|||
package buildcraft.robots.ai;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import buildcraft.api.core.BlockIndex;
|
||||
import buildcraft.api.robots.AIRobot;
|
||||
import buildcraft.api.robots.EntityRobotBase;
|
||||
import buildcraft.core.utils.BlockUtils;
|
||||
|
||||
public class AIRobotPumpBlock extends AIRobot {
|
||||
|
||||
|
@ -49,18 +46,13 @@ public class AIRobotPumpBlock extends AIRobot {
|
|||
if (waited < 40) {
|
||||
waited++;
|
||||
} else {
|
||||
Fluid fluid = FluidRegistry.lookupFluidForBlock(robot.worldObj.getBlock(blockToPump.x, blockToPump.y,
|
||||
blockToPump.z));
|
||||
|
||||
if (fluid != null) {
|
||||
pumped = robot.fill(ForgeDirection.UNKNOWN,
|
||||
new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME), true);
|
||||
|
||||
if (pumped > 0) {
|
||||
robot.worldObj.setBlockToAir(blockToPump.x, blockToPump.y, blockToPump.z);
|
||||
FluidStack fluidStack = BlockUtils.drainBlock(robot.worldObj, blockToPump.x, blockToPump.y, blockToPump.z, false);
|
||||
if (fluidStack != null) {
|
||||
if (robot.fill(ForgeDirection.UNKNOWN, fluidStack, true) > 0) {
|
||||
BlockUtils.drainBlock(robot.worldObj, blockToPump.x, blockToPump.y,
|
||||
blockToPump.z, true);
|
||||
}
|
||||
}
|
||||
|
||||
terminate();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue