Corrected a possible pump connection issue
This commit is contained in:
parent
f2bdbd3cb0
commit
f7c6588335
2 changed files with 224 additions and 205 deletions
|
@ -76,7 +76,10 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
||||||
@Override
|
@Override
|
||||||
public boolean isDisabled()
|
public boolean isDisabled()
|
||||||
{
|
{
|
||||||
if (disableTimer <= 0) { return false; }
|
if (disableTimer <= 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,14 +92,18 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
||||||
{
|
{
|
||||||
// consume/give away stored units
|
// consume/give away stored units
|
||||||
this.chargeUp();
|
this.chargeUp();
|
||||||
|
|
||||||
TileEntity ent = worldObj.getBlockTileEntity(xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ);
|
TileEntity ent = worldObj.getBlockTileEntity(xCoord + side.offsetX, yCoord + side.offsetY, zCoord + side.offsetZ);
|
||||||
|
|
||||||
if (ent instanceof ITankContainer)
|
if (ent instanceof ITankContainer)
|
||||||
{
|
{
|
||||||
this.fillTarget = (ITankContainer) ent;
|
this.fillTarget = (ITankContainer) ent;
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ent = null;
|
ent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.canPump(xCoord, yCoord - 1, zCoord) && this.joulesReceived >= this.WATTS_PER_TICK)
|
if (this.canPump(xCoord, yCoord - 1, zCoord) && this.joulesReceived >= this.WATTS_PER_TICK)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -184,13 +191,25 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
||||||
int meta = worldObj.getBlockMetadata(x, y, z);
|
int meta = worldObj.getBlockMetadata(x, y, z);
|
||||||
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
|
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
|
||||||
|
|
||||||
if (this.fillTarget == null || this.fillTarget.fill(side, this.color.getLiquidData().getStack(), false) == 0) { return false; }
|
if (this.fillTarget == null || this.fillTarget.fill(side, this.color.getLiquidData().getStack(), false) == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.isDisabled()) { return false; }
|
if (this.isDisabled())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ((LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == null || LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == LiquidHandler.unkown)) { return false; }
|
if ((LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == null || LiquidHandler.getFromBlockID(worldObj.getBlockId(x, y, z)) == LiquidHandler.unkown))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (blockID == Block.waterMoving.blockID || blockID == Block.lavaStill.blockID) { return false; }
|
if (blockID == Block.waterMoving.blockID || blockID == Block.lavaStill.blockID)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (blockID == Block.waterStill.blockID || blockID == Block.waterStill.blockID)
|
if (blockID == Block.waterStill.blockID || blockID == Block.waterStill.blockID)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -209,6 +228,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
||||||
int blockID = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ());
|
int blockID = worldObj.getBlockId(loc.intX(), loc.intY(), loc.intZ());
|
||||||
int meta = worldObj.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ());
|
int meta = worldObj.getBlockMetadata(loc.intX(), loc.intY(), loc.intZ());
|
||||||
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
|
LiquidData resource = LiquidHandler.getFromBlockID(blockID);
|
||||||
|
|
||||||
if (resource == color.getLiquidData() && meta == 0 && this.fillTarget.fill(back, resource.getStack(), false) != 0)
|
if (resource == color.getLiquidData() && meta == 0 && this.fillTarget.fill(back, resource.getStack(), false) != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -239,6 +259,7 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
public String getMeterReading(EntityPlayer user, ForgeDirection side)
|
||||||
{
|
{
|
||||||
|
@ -248,16 +269,17 @@ public class TileEntityPump extends TileEntityElectricityReceiver implements IPa
|
||||||
@Override
|
@Override
|
||||||
public int getPressureOut(LiquidData type, ForgeDirection dir)
|
public int getPressureOut(LiquidData type, ForgeDirection dir)
|
||||||
{
|
{
|
||||||
if (type == this.color.getLiquidData() || type == LiquidHandler.unkown)
|
if (type != null && this.color.isValidLiquid(type.getStack()))
|
||||||
return this.color.getLiquidData().getPressure();
|
{
|
||||||
|
return type.getPressure();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getCanPressureTo(LiquidData type, ForgeDirection dir)
|
public boolean getCanPressureTo(LiquidData type, ForgeDirection dir)
|
||||||
{
|
{
|
||||||
if (dir == this.side.getOpposite() && (type == this.color.getLiquidData() || type == LiquidHandler.unkown)) { return true; }
|
return dir == this.side.getOpposite() && this.color.isValidLiquid(type.getStack());
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,17 @@
|
||||||
package fluidmech.common.machines.pipes;
|
package fluidmech.common.machines.pipes;
|
||||||
|
|
||||||
import com.google.common.io.ByteArrayDataInput;
|
|
||||||
|
|
||||||
import hydraulic.core.implement.ColorCode;
|
|
||||||
import hydraulic.core.prefab.TileEntityFluidConveyor;
|
|
||||||
import fluidmech.common.FluidMech;
|
import fluidmech.common.FluidMech;
|
||||||
|
import hydraulic.core.implement.ColorCode;
|
||||||
|
import hydraulic.prefab.TileEntityFluidConveyor;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.network.INetworkManager;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import net.minecraftforge.liquids.LiquidContainerData;
|
|
||||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||||
import net.minecraftforge.liquids.LiquidStack;
|
import net.minecraftforge.liquids.LiquidStack;
|
||||||
import universalelectricity.prefab.tile.TileEntityConductor;
|
|
||||||
import basiccomponents.common.BCLoader;
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
public class TileEntityNewPipes extends TileEntityFluidConveyor
|
public class TileEntityNewPipes extends TileEntityFluidConveyor
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue