Merge pull request #2626 from hea3ven/6.4.x

fix fluid dupe with the pump robot
This commit is contained in:
Adrian Siekierka 2015-04-10 19:45:49 +02:00
commit 27570d8db5

View file

@ -9,14 +9,11 @@
package buildcraft.robots.ai; package buildcraft.robots.ai;
import net.minecraftforge.common.util.ForgeDirection; 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 net.minecraftforge.fluids.FluidStack;
import buildcraft.api.core.BlockIndex; import buildcraft.api.core.BlockIndex;
import buildcraft.api.robots.AIRobot; import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase; import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.utils.BlockUtils;
public class AIRobotPumpBlock extends AIRobot { public class AIRobotPumpBlock extends AIRobot {
@ -49,18 +46,13 @@ public class AIRobotPumpBlock extends AIRobot {
if (waited < 40) { if (waited < 40) {
waited++; waited++;
} else { } else {
Fluid fluid = FluidRegistry.lookupFluidForBlock(robot.worldObj.getBlock(blockToPump.x, blockToPump.y, FluidStack fluidStack = BlockUtils.drainBlock(robot.worldObj, blockToPump.x, blockToPump.y, blockToPump.z, false);
blockToPump.z)); if (fluidStack != null) {
if (robot.fill(ForgeDirection.UNKNOWN, fluidStack, true) > 0) {
if (fluid != null) { BlockUtils.drainBlock(robot.worldObj, blockToPump.x, blockToPump.y,
pumped = robot.fill(ForgeDirection.UNKNOWN, blockToPump.z, true);
new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME), true);
if (pumped > 0) {
robot.worldObj.setBlockToAir(blockToPump.x, blockToPump.y, blockToPump.z);
} }
} }
terminate(); terminate();
} }