use of buildcraft.transport.container.ContainerDiamondPipe in project BuildCraft by BuildCraft.
the class TransportGuiHandler method getServerGuiElement.
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
BlockPos pos = new BlockPos(x, y, z);
try {
if (!world.isBlockLoaded(pos)) {
return null;
}
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileFilteredBuffer) {
TileFilteredBuffer filteredBuffer = (TileFilteredBuffer) tile;
return new ContainerFilteredBuffer(player, filteredBuffer);
}
if (!(tile instanceof IPipeTile)) {
return null;
}
IPipeTile pipe = (IPipeTile) tile;
if (pipe.getPipe() == null) {
return null;
}
switch(id) {
case GuiIds.PIPE_DIAMOND:
return new ContainerDiamondPipe(player, (IDiamondPipe) pipe.getPipe());
case GuiIds.PIPE_EMERALD_ITEM:
return new ContainerDiamondWoodPipe(player, (PipeItemsEmerald) pipe.getPipe());
case GuiIds.PIPE_LOGEMERALD_ITEM:
return new ContainerEmzuliPipe(player, (PipeItemsEmzuli) pipe.getPipe());
case GuiIds.PIPE_EMERALD_FLUID:
return new ContainerEmeraldFluidPipe(player, (PipeFluidsEmerald) pipe.getPipe());
case GuiIds.GATES:
return new ContainerGateInterface(player, pipe.getPipe());
default:
return null;
}
} catch (Exception ex) {
BCLog.logger.log(Level.ERROR, "Failed to open GUI", ex);
}
return null;
}
use of buildcraft.transport.container.ContainerDiamondPipe in project BuildCraft by BuildCraft.
the class BCTransportProxy method getServerGuiElement.
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
BCTransportGuis gui = BCTransportGuis.get(id);
if (gui == null)
return null;
TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
switch(gui) {
case FILTERED_BUFFER:
{
if (tile instanceof TileFilteredBuffer) {
TileFilteredBuffer filteredBuffer = (TileFilteredBuffer) tile;
return new ContainerFilteredBuffer_BC8(player, filteredBuffer);
}
break;
}
case PIPE_DIAMOND:
{
if (tile instanceof IPipeHolder) {
IPipeHolder holder = (IPipeHolder) tile;
IPipe pipe = holder.getPipe();
if (pipe == null)
return null;
PipeBehaviour behaviour = pipe.getBehaviour();
if (behaviour instanceof PipeBehaviourDiamond) {
PipeBehaviourDiamond diaPipe = (PipeBehaviourDiamond) behaviour;
return new ContainerDiamondPipe(player, diaPipe);
}
}
break;
}
case PIPE_DIAMOND_WOOD:
{
if (tile instanceof IPipeHolder) {
IPipeHolder holder = (IPipeHolder) tile;
IPipe pipe = holder.getPipe();
if (pipe == null)
return null;
PipeBehaviour behaviour = pipe.getBehaviour();
if (behaviour instanceof PipeBehaviourWoodDiamond) {
PipeBehaviourWoodDiamond diaPipe = (PipeBehaviourWoodDiamond) behaviour;
return new ContainerDiamondWoodPipe(player, diaPipe);
}
}
break;
}
case PIPE_EMZULI:
{
if (tile instanceof IPipeHolder) {
IPipeHolder holder = (IPipeHolder) tile;
IPipe pipe = holder.getPipe();
if (pipe == null)
return null;
PipeBehaviour behaviour = pipe.getBehaviour();
if (behaviour instanceof PipeBehaviourEmzuli) {
PipeBehaviourEmzuli emPipe = (PipeBehaviourEmzuli) behaviour;
return new ContainerEmzuliPipe_BC8(player, emPipe);
}
}
break;
}
case GATE:
{
int ry = y >> 3;
EnumFacing gateSide = EnumFacing.getFront(y & 0x7);
tile = world.getTileEntity(new BlockPos(x, ry, z));
if (tile instanceof IPipeHolder) {
IPipeHolder holder = (IPipeHolder) tile;
PipePluggable plug = holder.getPluggable(gateSide);
if (plug instanceof PluggableGate) {
return new ContainerGate(player, ((PluggableGate) plug).logic);
}
}
break;
}
}
return null;
}
Aggregations