Merge branch 'master' into builder
This commit is contained in:
commit
8c069901d2
11 changed files with 43 additions and 34 deletions
|
@ -1,3 +1,3 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Thu Aug 01 17:24:24 CEST 2013
|
||||
build.number=37
|
||||
#Wed Aug 07 16:42:06 CEST 2013
|
||||
build.number=38
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
package buildcraft.core.liquids;
|
||||
package buildcraft.core.fluids;
|
||||
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.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.IFluidHandler;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -72,4 +75,23 @@ public class FluidUtils {
|
|||
return moving ? Block.lavaMoving.blockID : Block.lavaStill.blockID;
|
||||
return fluid.getBlockID();
|
||||
}
|
||||
|
||||
public static void pushFluidToConsumers(IFluidTank tank, int flowCap, TileBuffer[] tileBuffer) {
|
||||
int amountToPush = flowCap;
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
FluidStack fluidStack = tank.drain(amountToPush, false);
|
||||
if (fluidStack != null && fluidStack.amount > 0) {
|
||||
TileEntity tile = tileBuffer[side.ordinal()].getTile();
|
||||
if (tile instanceof IFluidHandler) {
|
||||
int used = ((IFluidHandler) tile).fill(side.getOpposite(), fluidStack, true);
|
||||
if (used > 0) {
|
||||
amountToPush -= used;
|
||||
tank.drain(used, true);
|
||||
if (amountToPush <= 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.liquids;
|
||||
package buildcraft.core.fluids;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.liquids;
|
||||
package buildcraft.core.fluids;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.liquids;
|
||||
package buildcraft.core.fluids;
|
||||
|
||||
import buildcraft.core.gui.tooltips.ToolTip;
|
||||
import buildcraft.core.gui.tooltips.ToolTipLine;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.core.liquids;
|
||||
package buildcraft.core.fluids;
|
||||
|
||||
import com.google.common.collect.ForwardingList;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
|
|
@ -16,9 +16,9 @@ import buildcraft.api.fuels.IronEngineFuel.Fuel;
|
|||
import buildcraft.api.gates.ITrigger;
|
||||
import buildcraft.core.GuiIds;
|
||||
import buildcraft.core.IItemPipe;
|
||||
import buildcraft.core.liquids.FluidUtils;
|
||||
import buildcraft.core.liquids.Tank;
|
||||
import buildcraft.core.liquids.TankManager;
|
||||
import buildcraft.core.fluids.FluidUtils;
|
||||
import buildcraft.core.fluids.Tank;
|
||||
import buildcraft.core.fluids.TankManager;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import buildcraft.energy.gui.ContainerEngine;
|
||||
|
|
|
@ -10,8 +10,8 @@ package buildcraft.factory;
|
|||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import buildcraft.core.BlockIndex;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.liquids.FluidUtils;
|
||||
import buildcraft.core.liquids.Tank;
|
||||
import buildcraft.core.fluids.FluidUtils;
|
||||
import buildcraft.core.fluids.Tank;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.BlockUtil;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
|
|
@ -20,7 +20,8 @@ import buildcraft.core.EntityBlock;
|
|||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.TileBuffer;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.liquids.SingleUseTank;
|
||||
import buildcraft.core.fluids.FluidUtils;
|
||||
import buildcraft.core.fluids.SingleUseTank;
|
||||
import buildcraft.core.network.PacketPayload;
|
||||
import buildcraft.core.network.PacketPayloadStream;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
|
@ -132,23 +133,9 @@ public class TilePump extends TileBuildCraft implements IMachine, IPowerReceptor
|
|||
}
|
||||
|
||||
private void pushToConsumers() {
|
||||
FluidStack fluidStack = tank.getFluid();
|
||||
if (fluidStack != null && fluidStack.amount > 0) {
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity tile = getTile(side);
|
||||
|
||||
if (tile instanceof IFluidHandler) {
|
||||
int moved = ((IFluidHandler) tile).fill(side.getOpposite(), fluidStack, true);
|
||||
if (moved > 0) {
|
||||
tank.drain(moved, true);
|
||||
fluidStack = tank.getFluid();
|
||||
if (fluidStack == null || fluidStack.amount <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tileBuffer == null)
|
||||
tileBuffer = TileBuffer.makeBuffer(worldObj, xCoord, yCoord, zCoord, false);
|
||||
FluidUtils.pushFluidToConsumers(tank, 400, tileBuffer);
|
||||
}
|
||||
|
||||
private TileEntity getTile(ForgeDirection side) {
|
||||
|
|
|
@ -18,8 +18,8 @@ import buildcraft.api.recipes.RefineryRecipes;
|
|||
import buildcraft.api.recipes.RefineryRecipes.Recipe;
|
||||
import buildcraft.core.IMachine;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.liquids.Tank;
|
||||
import buildcraft.core.liquids.TankManager;
|
||||
import buildcraft.core.fluids.Tank;
|
||||
import buildcraft.core.fluids.TankManager;
|
||||
import buildcraft.core.network.PacketPayload;
|
||||
import buildcraft.core.network.PacketPayloadStream;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
|
|
|
@ -10,8 +10,8 @@ package buildcraft.factory;
|
|||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.liquids.Tank;
|
||||
import buildcraft.core.liquids.TankManager;
|
||||
import buildcraft.core.fluids.Tank;
|
||||
import buildcraft.core.fluids.TankManager;
|
||||
import buildcraft.core.network.PacketPayload;
|
||||
import buildcraft.core.network.PacketPayloadStream;
|
||||
import buildcraft.core.network.PacketUpdate;
|
||||
|
|
Loading…
Add table
Reference in a new issue