Changed IPipeConnection to return three states
And fix engines connecting to pipes. This is why I shouldn't code at 5 AM.
This commit is contained in:
parent
447b914fb5
commit
91a84f2062
5 changed files with 81 additions and 102 deletions
|
@ -12,5 +12,18 @@ import net.minecraftforge.common.ForgeDirection;
|
||||||
|
|
||||||
public interface IPipeConnection {
|
public interface IPipeConnection {
|
||||||
|
|
||||||
public boolean overridePipeConnection(PipeType type, ForgeDirection with);
|
enum ConnectOverride {
|
||||||
|
|
||||||
|
CONNECT, DISCONNECT, DEFAULT
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows you to override pipe connection logic.
|
||||||
|
*
|
||||||
|
* @param type
|
||||||
|
* @param with
|
||||||
|
* @return CONNECT to force a connection, DISCONNECT to force no connection,
|
||||||
|
* and DEFAULT to let the pipe decide.
|
||||||
|
*/
|
||||||
|
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with);
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,24 +97,22 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
|
|
||||||
protected EnergyStage computeEnergyStage() {
|
protected EnergyStage computeEnergyStage() {
|
||||||
float energyLevel = getHeatLevel();
|
float energyLevel = getHeatLevel();
|
||||||
if (energyLevel < 0.25f) {
|
if (energyLevel < 0.25f)
|
||||||
return EnergyStage.BLUE;
|
return EnergyStage.BLUE;
|
||||||
} else if (energyLevel < 0.5f) {
|
else if (energyLevel < 0.5f)
|
||||||
return EnergyStage.GREEN;
|
return EnergyStage.GREEN;
|
||||||
} else if (energyLevel < 0.75f) {
|
else if (energyLevel < 0.75f)
|
||||||
return EnergyStage.YELLOW;
|
return EnergyStage.YELLOW;
|
||||||
} else if (energyLevel < 1f) {
|
else if (energyLevel < 1f)
|
||||||
return EnergyStage.RED;
|
return EnergyStage.RED;
|
||||||
} else {
|
else
|
||||||
return EnergyStage.OVERHEAT;
|
return EnergyStage.OVERHEAT;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final EnergyStage getEnergyStage() {
|
public final EnergyStage getEnergyStage() {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
||||||
if (energyStage == EnergyStage.OVERHEAT) {
|
if (energyStage == EnergyStage.OVERHEAT)
|
||||||
return energyStage;
|
return energyStage;
|
||||||
}
|
|
||||||
EnergyStage newStage = computeEnergyStage();
|
EnergyStage newStage = computeEnergyStage();
|
||||||
|
|
||||||
if (energyStage != newStage) {
|
if (energyStage != newStage) {
|
||||||
|
@ -143,9 +141,8 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getPistonSpeed() {
|
public float getPistonSpeed() {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (CoreProxy.proxy.isSimulating(worldObj))
|
||||||
return Math.max(0.16f * getHeatLevel(), 0.01f);
|
return Math.max(0.16f * getHeatLevel(), 0.01f);
|
||||||
}
|
|
||||||
switch (getEnergyStage()) {
|
switch (getEnergyStage()) {
|
||||||
case BLUE:
|
case BLUE:
|
||||||
return 0.02F;
|
return 0.02F;
|
||||||
|
@ -172,9 +169,8 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
progressPart = 0;
|
progressPart = 0;
|
||||||
progress = 0;
|
progress = 0;
|
||||||
}
|
}
|
||||||
} else if (this.isPumping) {
|
} else if (this.isPumping)
|
||||||
progressPart = 1;
|
progressPart = 1;
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -194,21 +190,17 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
progress = 0;
|
progress = 0;
|
||||||
progressPart = 0;
|
progressPart = 0;
|
||||||
}
|
}
|
||||||
} else if (isRedstonePowered && isActive()) {
|
} else if (isRedstonePowered && isActive())
|
||||||
if (isPoweredTile(tile, orientation)) {
|
if (isPoweredTile(tile, orientation))
|
||||||
if (getPowerToExtract() > 0) {
|
if (getPowerToExtract() > 0) {
|
||||||
progressPart = 1;
|
progressPart = 1;
|
||||||
setPumping(true);
|
setPumping(true);
|
||||||
} else {
|
} else
|
||||||
setPumping(false);
|
setPumping(false);
|
||||||
}
|
else
|
||||||
} else {
|
|
||||||
setPumping(false);
|
setPumping(false);
|
||||||
}
|
else
|
||||||
|
|
||||||
} else {
|
|
||||||
setPumping(false);
|
setPumping(false);
|
||||||
}
|
|
||||||
|
|
||||||
// Uncomment for constant power
|
// Uncomment for constant power
|
||||||
// if (isRedstonePowered && isActive()) {
|
// if (isRedstonePowered && isActive()) {
|
||||||
|
@ -248,13 +240,11 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void engineUpdate() {
|
protected void engineUpdate() {
|
||||||
if (!isRedstonePowered) {
|
if (!isRedstonePowered)
|
||||||
if (energy >= 1) {
|
if (energy >= 1)
|
||||||
energy -= 1;
|
energy -= 1;
|
||||||
} else if (energy < 1) {
|
else if (energy < 1)
|
||||||
energy = 0;
|
energy = 0;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
|
@ -295,9 +285,8 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
progress = data.getFloat("progress");
|
progress = data.getFloat("progress");
|
||||||
energy = data.getFloat("energyF");
|
energy = data.getFloat("energyF");
|
||||||
NBTBase tag = data.getTag("heat");
|
NBTBase tag = data.getTag("heat");
|
||||||
if (tag instanceof NBTTagFloat) {
|
if (tag instanceof NBTTagFloat)
|
||||||
heat = data.getFloat("heat");
|
heat = data.getFloat("heat");
|
||||||
}
|
|
||||||
inv.readFromNBT(data);
|
inv.readFromNBT(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,9 +404,8 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (energy > getMaxEnergy()) {
|
if (energy > getMaxEnergy())
|
||||||
energy = getMaxEnergy();
|
energy = getMaxEnergy();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float extractEnergy(float min, float max, boolean doExtract) {
|
public float extractEnergy(float min, float max, boolean doExtract) {
|
||||||
|
@ -426,11 +414,10 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
|
|
||||||
float actualMax;
|
float actualMax;
|
||||||
|
|
||||||
if (max > maxEnergyExtracted()) {
|
if (max > maxEnergyExtracted())
|
||||||
actualMax = maxEnergyExtracted();
|
actualMax = maxEnergyExtracted();
|
||||||
} else {
|
else
|
||||||
actualMax = max;
|
actualMax = max;
|
||||||
}
|
|
||||||
|
|
||||||
if (actualMax < min)
|
if (actualMax < min)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -439,23 +426,20 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
|
|
||||||
if (energy >= actualMax) {
|
if (energy >= actualMax) {
|
||||||
extracted = actualMax;
|
extracted = actualMax;
|
||||||
if (doExtract) {
|
if (doExtract)
|
||||||
energy -= actualMax;
|
energy -= actualMax;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
extracted = energy;
|
extracted = energy;
|
||||||
if (doExtract) {
|
if (doExtract)
|
||||||
energy = 0;
|
energy = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return extracted;
|
return extracted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPoweredTile(TileEntity tile, ForgeDirection side) {
|
public boolean isPoweredTile(TileEntity tile, ForgeDirection side) {
|
||||||
if (tile instanceof IPowerReceptor) {
|
if (tile instanceof IPowerReceptor)
|
||||||
return ((IPowerReceptor) tile).getPowerReceiver(side.getOpposite()) != null;
|
return ((IPowerReceptor) tile).getPowerReceiver(side.getOpposite()) != null;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -499,8 +483,12 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean overridePipeConnection(PipeType type, ForgeDirection with) {
|
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with) {
|
||||||
return with != orientation;
|
if (type == PipeType.POWER)
|
||||||
|
return ConnectOverride.DEFAULT;
|
||||||
|
if (with == orientation)
|
||||||
|
return ConnectOverride.DISCONNECT;
|
||||||
|
return ConnectOverride.DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,7 +10,6 @@ package buildcraft.energy;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import buildcraft.api.gates.ITrigger;
|
import buildcraft.api.gates.ITrigger;
|
||||||
import buildcraft.core.DefaultProps;
|
|
||||||
import buildcraft.core.GuiIds;
|
import buildcraft.core.GuiIds;
|
||||||
import buildcraft.core.proxy.CoreProxy;
|
import buildcraft.core.proxy.CoreProxy;
|
||||||
import buildcraft.core.utils.Utils;
|
import buildcraft.core.utils.Utils;
|
||||||
|
|
|
@ -43,22 +43,20 @@ public class TileEngineWood extends TileEngine {
|
||||||
@Override
|
@Override
|
||||||
protected EnergyStage computeEnergyStage() {
|
protected EnergyStage computeEnergyStage() {
|
||||||
float energyLevel = getEnergyLevel();
|
float energyLevel = getEnergyLevel();
|
||||||
if (energyLevel < 0.25f) {
|
if (energyLevel < 0.25f)
|
||||||
return EnergyStage.BLUE;
|
return EnergyStage.BLUE;
|
||||||
} else if (energyLevel < 0.5f) {
|
else if (energyLevel < 0.5f)
|
||||||
return EnergyStage.GREEN;
|
return EnergyStage.GREEN;
|
||||||
} else if (energyLevel < 0.75f) {
|
else if (energyLevel < 0.75f)
|
||||||
return EnergyStage.YELLOW;
|
return EnergyStage.YELLOW;
|
||||||
} else {
|
else
|
||||||
return EnergyStage.RED;
|
return EnergyStage.RED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getPistonSpeed() {
|
public float getPistonSpeed() {
|
||||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
if (CoreProxy.proxy.isSimulating(worldObj))
|
||||||
return Math.max(0.8f * getHeatLevel(), 0.01f);
|
return Math.max(0.8f * getHeatLevel(), 0.01f);
|
||||||
}
|
|
||||||
switch (getEnergyStage()) {
|
switch (getEnergyStage()) {
|
||||||
case BLUE:
|
case BLUE:
|
||||||
return 0.01F;
|
return 0.01F;
|
||||||
|
@ -77,16 +75,14 @@ public class TileEngineWood extends TileEngine {
|
||||||
public void engineUpdate() {
|
public void engineUpdate() {
|
||||||
super.engineUpdate();
|
super.engineUpdate();
|
||||||
|
|
||||||
if (isRedstonePowered) {
|
if (isRedstonePowered)
|
||||||
if (worldObj.getWorldTime() % 20 == 0) {
|
if (worldObj.getWorldTime() % 20 == 0)
|
||||||
addEnergy(1);
|
addEnergy(1);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean overridePipeConnection(PipeType type, ForgeDirection with) {
|
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with) {
|
||||||
return false;
|
return ConnectOverride.DISCONNECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -95,9 +95,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
if (pipe != null) {
|
if (pipe != null) {
|
||||||
nbt.setInteger("pipeId", pipe.itemID);
|
nbt.setInteger("pipeId", pipe.itemID);
|
||||||
pipe.writeToNBT(nbt);
|
pipe.writeToNBT(nbt);
|
||||||
} else {
|
} else
|
||||||
nbt.setInteger("pipeId", coreState.pipeId);
|
nbt.setInteger("pipeId", coreState.pipeId);
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
for (int i = 0; i < ForgeDirection.VALID_DIRECTIONS.length; i++) {
|
||||||
nbt.setInteger("facadeBlocks[" + i + "]", facadeBlocks[i]);
|
nbt.setInteger("facadeBlocks[" + i + "]", facadeBlocks[i]);
|
||||||
|
@ -114,9 +113,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
coreState.pipeId = nbt.getInteger("pipeId");
|
coreState.pipeId = nbt.getInteger("pipeId");
|
||||||
pipe = BlockGenericPipe.createPipe(coreState.pipeId);
|
pipe = BlockGenericPipe.createPipe(coreState.pipeId);
|
||||||
|
|
||||||
if (pipe != null) {
|
if (pipe != null)
|
||||||
pipe.readFromNBT(nbt);
|
pipe.readFromNBT(nbt);
|
||||||
} else {
|
else {
|
||||||
BuildCraftCore.bcLog.log(Level.WARNING, "Pipe failed to load from NBT at {0},{1},{2}", new Object[]{xCoord, yCoord, zCoord});
|
BuildCraftCore.bcLog.log(Level.WARNING, "Pipe failed to load from NBT at {0},{1},{2}", new Object[]{xCoord, yCoord, zCoord});
|
||||||
deletePipe = true;
|
deletePipe = true;
|
||||||
}
|
}
|
||||||
|
@ -133,9 +132,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
initialized = false;
|
initialized = false;
|
||||||
tileBuffer = null;
|
tileBuffer = null;
|
||||||
if (pipe != null) {
|
if (pipe != null)
|
||||||
pipe.invalidate();
|
pipe.invalidate();
|
||||||
}
|
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,25 +142,22 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
super.validate();
|
super.validate();
|
||||||
tileBuffer = null;
|
tileBuffer = null;
|
||||||
bindPipe();
|
bindPipe();
|
||||||
if (pipe != null) {
|
if (pipe != null)
|
||||||
pipe.validate();
|
pipe.validate();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public boolean initialized = false;
|
public boolean initialized = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
|
||||||
if (deletePipe) {
|
if (deletePipe)
|
||||||
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
worldObj.setBlockToAir(xCoord, yCoord, zCoord);
|
||||||
}
|
|
||||||
|
|
||||||
if (pipe == null)
|
if (pipe == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized)
|
||||||
initialize(pipe);
|
initialize(pipe);
|
||||||
}
|
|
||||||
|
|
||||||
if (!BlockGenericPipe.isValid(pipe))
|
if (!BlockGenericPipe.isValid(pipe))
|
||||||
return;
|
return;
|
||||||
|
@ -182,13 +177,11 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
|
|
||||||
PowerReceiver provider = getPowerReceiver(null);
|
PowerReceiver provider = getPowerReceiver(null);
|
||||||
|
|
||||||
if (provider != null) {
|
if (provider != null)
|
||||||
provider.update();
|
provider.update();
|
||||||
}
|
|
||||||
|
|
||||||
if (pipe != null) {
|
if (pipe != null)
|
||||||
pipe.updateEntity();
|
pipe.updateEntity();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PRECONDITION: worldObj must not be null
|
// PRECONDITION: worldObj must not be null
|
||||||
|
@ -272,12 +265,10 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
TileEntity tile = getTile(o);
|
TileEntity tile = getTile(o);
|
||||||
|
|
||||||
if (tile instanceof ITileBufferHolder) {
|
if (tile instanceof ITileBufferHolder)
|
||||||
((ITileBufferHolder) tile).blockCreated(o, BuildCraftTransport.genericPipeBlock.blockID, this);
|
((ITileBufferHolder) tile).blockCreated(o, BuildCraftTransport.genericPipeBlock.blockID, this);
|
||||||
}
|
if (tile instanceof TileGenericPipe)
|
||||||
if (tile instanceof TileGenericPipe) {
|
|
||||||
((TileGenericPipe) tile).scheduleNeighborChange();
|
((TileGenericPipe) tile).scheduleNeighborChange();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bindPipe();
|
bindPipe();
|
||||||
|
@ -321,9 +312,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doWork(PowerHandler workProvider) {
|
public void doWork(PowerHandler workProvider) {
|
||||||
if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor) {
|
if (BlockGenericPipe.isValid(pipe) && pipe instanceof IPowerReceptor)
|
||||||
((IPowerReceptor) pipe).doWork(workProvider);
|
((IPowerReceptor) pipe).doWork(workProvider);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scheduleNeighborChange() {
|
public void scheduleNeighborChange() {
|
||||||
|
@ -356,9 +346,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
/* SMP */
|
/* SMP */
|
||||||
public void handleDescriptionPacket(PipeRenderStatePacket packet) {
|
public void handleDescriptionPacket(PipeRenderStatePacket packet) {
|
||||||
if (worldObj.isRemote) {
|
if (worldObj.isRemote) {
|
||||||
if (pipe == null && packet.getPipeId() != 0) {
|
if (pipe == null && packet.getPipeId() != 0)
|
||||||
initialize(BlockGenericPipe.createPipe(packet.getPipeId()));
|
initialize(BlockGenericPipe.createPipe(packet.getPipeId()));
|
||||||
}
|
|
||||||
renderState = packet.getRenderState();
|
renderState = packet.getRenderState();
|
||||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||||
}
|
}
|
||||||
|
@ -369,21 +358,18 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
bindPipe();
|
bindPipe();
|
||||||
|
|
||||||
PacketTileState packet = new PacketTileState(this.xCoord, this.yCoord, this.zCoord);
|
PacketTileState packet = new PacketTileState(this.xCoord, this.yCoord, this.zCoord);
|
||||||
if (pipe != null && pipe.gate != null) {
|
if (pipe != null && pipe.gate != null)
|
||||||
coreState.gateKind = pipe.gate.kind.ordinal();
|
coreState.gateKind = pipe.gate.kind.ordinal();
|
||||||
} else {
|
else
|
||||||
coreState.gateKind = 0;
|
coreState.gateKind = 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (pipe != null && pipe.transport != null) {
|
if (pipe != null && pipe.transport != null)
|
||||||
pipe.transport.sendDescriptionPacket();
|
pipe.transport.sendDescriptionPacket();
|
||||||
}
|
|
||||||
|
|
||||||
packet.addStateForSerialization((byte) 0, coreState);
|
packet.addStateForSerialization((byte) 0, coreState);
|
||||||
packet.addStateForSerialization((byte) 1, renderState);
|
packet.addStateForSerialization((byte) 1, renderState);
|
||||||
if (pipe instanceof IClientState) {
|
if (pipe instanceof IClientState)
|
||||||
packet.addStateForSerialization((byte) 2, (IClientState) pipe);
|
packet.addStateForSerialization((byte) 2, (IClientState) pipe);
|
||||||
}
|
|
||||||
return packet.getPacket();
|
return packet.getPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -448,9 +434,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
|
|
||||||
if (!BlockGenericPipe.isValid(pipe))
|
if (!BlockGenericPipe.isValid(pipe))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(with instanceof IPipeConnection)
|
if (with instanceof IPipeConnection) {
|
||||||
return ((IPipeConnection)with).overridePipeConnection(pipe.transport.getPipeType(), side.getOpposite());
|
IPipeConnection.ConnectOverride override = ((IPipeConnection) with).overridePipeConnection(pipe.transport.getPipeType(), side.getOpposite());
|
||||||
|
if (override != IPipeConnection.ConnectOverride.DEFAULT)
|
||||||
|
return override == IPipeConnection.ConnectOverride.CONNECT ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
if (with instanceof TileGenericPipe) {
|
if (with instanceof TileGenericPipe) {
|
||||||
if (((TileGenericPipe) with).hasPlug(side.getOpposite()))
|
if (((TileGenericPipe) with).hasPlug(side.getOpposite()))
|
||||||
|
@ -497,9 +486,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkUnload() {
|
public void onChunkUnload() {
|
||||||
if (pipe != null) {
|
if (pipe != null)
|
||||||
pipe.onChunkUnload();
|
pipe.onChunkUnload();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -560,9 +548,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
if (this.facadeBlocks[direction.ordinal()] == blockid)
|
if (this.facadeBlocks[direction.ordinal()] == blockid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (hasFacade(direction)) {
|
if (hasFacade(direction))
|
||||||
dropFacadeItem(direction);
|
dropFacadeItem(direction);
|
||||||
}
|
|
||||||
|
|
||||||
this.facadeBlocks[direction.ordinal()] = blockid;
|
this.facadeBlocks[direction.ordinal()] = blockid;
|
||||||
this.facadeMeta[direction.ordinal()] = meta;
|
this.facadeMeta[direction.ordinal()] = meta;
|
||||||
|
@ -629,13 +616,11 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
|
|
||||||
switch (stateId) {
|
switch (stateId) {
|
||||||
case 0:
|
case 0:
|
||||||
if (pipe == null && coreState.pipeId != 0) {
|
if (pipe == null && coreState.pipeId != 0)
|
||||||
initialize(BlockGenericPipe.createPipe(coreState.pipeId));
|
initialize(BlockGenericPipe.createPipe(coreState.pipeId));
|
||||||
}
|
|
||||||
if (pipe != null && coreState.gateKind != GateKind.None.ordinal()) {
|
if (pipe != null && coreState.gateKind != GateKind.None.ordinal()) {
|
||||||
if (pipe.gate == null) {
|
if (pipe.gate == null)
|
||||||
pipe.gate = new GateVanilla(pipe);
|
pipe.gate = new GateVanilla(pipe);
|
||||||
}
|
|
||||||
pipe.gate.kind = GateKind.values()[coreState.gateKind];
|
pipe.gate.kind = GateKind.values()[coreState.gateKind];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -659,10 +644,9 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
if (hasFacade(side))
|
if (hasFacade(side))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (BlockGenericPipe.isValid(pipe) && pipe instanceof ISolidSideTile) {
|
if (BlockGenericPipe.isValid(pipe) && pipe instanceof ISolidSideTile)
|
||||||
if (((ISolidSideTile) pipe).isSolidOnSide(side))
|
if (((ISolidSideTile) pipe).isSolidOnSide(side))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,9 +682,8 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, IFlui
|
||||||
|
|
||||||
public int getBlockId() {
|
public int getBlockId() {
|
||||||
Block block = getBlockType();
|
Block block = getBlockType();
|
||||||
if (block != null) {
|
if (block != null)
|
||||||
return block.blockID;
|
return block.blockID;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue