Search in sources :

Example 1 with GuiXNetManual

use of mcjty.xnet.items.manual.GuiXNetManual in project XNet by McJty.

the class GuiProxy method getClientGuiElement.

@Override
public Object getClientGuiElement(int guiid, EntityPlayer entityPlayer, World world, int x, int y, int z) {
    if (guiid == GUI_MANUAL_XNET) {
        return new GuiXNetManual(GuiXNetManual.MANUAL_XNET);
    }
    BlockPos pos = new BlockPos(x, y, z);
    Block block = world.getBlockState(pos).getBlock();
    if (block instanceof GenericBlock) {
        GenericBlock<?, ?> genericBlock = (GenericBlock<?, ?>) block;
        TileEntity te = world.getTileEntity(pos);
        return genericBlock.createClientGui(entityPlayer, te);
    } else if (block instanceof ConnectorBlock) {
        TileEntity te = world.getTileEntity(pos);
        return new GuiConnector((ConnectorTileEntity) te, new EmptyContainer(entityPlayer, null));
    }
    return null;
}
Also used : GuiXNetManual(mcjty.xnet.items.manual.GuiXNetManual) GenericBlock(mcjty.lib.container.GenericBlock) ConnectorTileEntity(mcjty.xnet.blocks.cables.ConnectorTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) EmptyContainer(mcjty.lib.container.EmptyContainer) GuiConnector(mcjty.xnet.blocks.cables.GuiConnector) ConnectorTileEntity(mcjty.xnet.blocks.cables.ConnectorTileEntity) GenericBlock(mcjty.lib.container.GenericBlock) Block(net.minecraft.block.Block) ConnectorBlock(mcjty.xnet.blocks.cables.ConnectorBlock) BlockPos(net.minecraft.util.math.BlockPos) ConnectorBlock(mcjty.xnet.blocks.cables.ConnectorBlock)

Aggregations

EmptyContainer (mcjty.lib.container.EmptyContainer)1 GenericBlock (mcjty.lib.container.GenericBlock)1 ConnectorBlock (mcjty.xnet.blocks.cables.ConnectorBlock)1 ConnectorTileEntity (mcjty.xnet.blocks.cables.ConnectorTileEntity)1 GuiConnector (mcjty.xnet.blocks.cables.GuiConnector)1 GuiXNetManual (mcjty.xnet.items.manual.GuiXNetManual)1 Block (net.minecraft.block.Block)1 TileEntity (net.minecraft.tileentity.TileEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1