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;
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();
}