#676: adds a generic interface for pipe(tiles) to allow them to be solid on a side, a facade always overwrites it

This commit is contained in:
Flow86 2013-03-18 09:48:24 +01:00
parent b8db6ef027
commit 602f5b8b22
3 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,7 @@
package buildcraft.api.transport;
import net.minecraftforge.common.ForgeDirection;
public interface ISolidSideTile {
public boolean isSolidOnSide(ForgeDirection side);
}

View file

@ -40,6 +40,7 @@ import buildcraft.api.gates.IAction;
import buildcraft.api.gates.ITrigger;
import buildcraft.api.tools.IToolWrench;
import buildcraft.api.transport.IPipe;
import buildcraft.api.transport.ISolidSideTile;
import buildcraft.core.BlockIndex;
import buildcraft.core.DefaultProps;
import buildcraft.core.proxy.CoreProxy;
@ -98,6 +99,15 @@ public class BlockGenericPipe extends BlockContainer {
return false;
}
@Override
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) {
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof ISolidSideTile) {
return ((ISolidSideTile) tile).isSolidOnSide(side);
}
return false;
}
public boolean isACube() {
return false;
}

View file

@ -43,6 +43,7 @@ import buildcraft.api.transport.IPipeConnection;
import buildcraft.api.transport.IPipeEntry;
import buildcraft.api.transport.IPipeTile;
import buildcraft.api.transport.IPipedItem;
import buildcraft.api.transport.ISolidSideTile;
import buildcraft.core.DefaultProps;
import buildcraft.core.EntityPassiveItem;
import buildcraft.core.IDropControlInventory;
@ -56,7 +57,7 @@ import buildcraft.transport.Gate.GateKind;
import buildcraft.transport.network.PipeRenderStatePacket;
public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITankContainer, IPipeEntry, IPipeTile, IOverrideDefaultTriggers, ITileBufferHolder,
IPipeConnection, IDropControlInventory, IPipeRenderState, ISyncedTile {
IPipeConnection, IDropControlInventory, IPipeRenderState, ISyncedTile, ISolidSideTile {
private class CoreState implements IClientState {
@ -663,4 +664,16 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
public boolean shouldRefresh(int oldID, int newID, int oldMeta, int newMeta, World world, int x, int y, int z) {
return oldID != newID;
}
@Override
public boolean isSolidOnSide(ForgeDirection side) {
if (hasFacade(side))
return true;
if (BlockGenericPipe.isValid(pipe) && pipe instanceof ISolidSideTile) {
if (((ISolidSideTile) pipe).isSolidOnSide(side))
return true;
}
return false;
}
}