Search in sources :

Example 1 with TileEntityCryogenicChamber

use of micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityCryogenicChamber in project Galacticraft by micdoodle8.

the class EventHandlerMars method orientCamera.

@SideOnly(Side.CLIENT)
@SubscribeEvent
public void orientCamera(OrientCameraEvent event) {
    EntityPlayer entity = Minecraft.getMinecraft().thePlayer;
    if (entity != null) {
        int x = MathHelper.floor_double(entity.posX);
        int y = MathHelper.floor_double(entity.posY);
        int z = MathHelper.floor_double(entity.posZ);
        TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(new BlockPos(x, y - 1, z));
        if (tile instanceof TileEntityMulti) {
            tile = ((TileEntityMulti) tile).getMainBlockTile();
        }
        if (tile instanceof TileEntityCryogenicChamber) {
            GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
            switch(tile.getBlockMetadata() & 3) {
                case 0:
                    GL11.glTranslatef(-0.4F, -0.5F, 4.1F);
                    break;
                case 1:
                    GL11.glTranslatef(0, -0.5F, 4.1F);
                    break;
                case 2:
                    GL11.glTranslatef(0, -0.5F, 4.1F);
                    break;
                case 3:
                    GL11.glTranslatef(0.0F, -0.5F, 4.1F);
                    break;
            }
            GL11.glRotatef(-180, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(FMLClientHandler.instance().getClientPlayerEntity().sleepTimer - 50, 0.0F, 1.0F, 0.0F);
            GL11.glTranslatef(0.0F, 0.3F, 0.0F);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityCryogenicChamber(micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityCryogenicChamber) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.BlockPos) TileEntityMulti(micdoodle8.mods.galacticraft.core.tile.TileEntityMulti) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with TileEntityCryogenicChamber

use of micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityCryogenicChamber in project Galacticraft by micdoodle8.

the class PacketSimpleMars method handleClientSide.

@SideOnly(Side.CLIENT)
@Override
public void handleClientSide(EntityPlayer player) {
    EntityPlayerSP playerBaseClient = null;
    if (player instanceof EntityPlayerSP) {
        playerBaseClient = (EntityPlayerSP) player;
    }
    switch(this.type) {
        case C_OPEN_CUSTOM_GUI:
            int entityID = 0;
            Entity entity = null;
            switch((Integer) this.data.get(1)) {
                case 0:
                    entityID = (Integer) this.data.get(2);
                    entity = player.worldObj.getEntityByID(entityID);
                    if (entity != null && entity instanceof EntitySlimeling) {
                        FMLClientHandler.instance().getClient().displayGuiScreen(new GuiSlimelingInventory(player, (EntitySlimeling) entity));
                    }
                    player.openContainer.windowId = (Integer) this.data.get(0);
                    break;
                case 1:
                    entityID = (Integer) this.data.get(2);
                    entity = player.worldObj.getEntityByID(entityID);
                    if (entity != null && entity instanceof EntityCargoRocket) {
                        FMLClientHandler.instance().getClient().displayGuiScreen(new GuiCargoRocket(player.inventory, (EntityCargoRocket) entity));
                    }
                    player.openContainer.windowId = (Integer) this.data.get(0);
                    break;
            }
            break;
        case C_OPEN_CUSTOM_GUI_TILE:
            BlockPos pos;
            TileEntity tile;
            switch((Integer) this.data.get(1)) {
                case 0:
                    pos = (BlockPos) this.data.get(2);
                    tile = player.worldObj.getTileEntity(pos);
                    if (tile != null && tile instanceof TileEntityLaunchController) {
                        FMLClientHandler.instance().getClient().displayGuiScreen(new GuiLaunchControllerAdvanced(player.inventory, (TileEntityLaunchController) tile));
                    }
                    player.openContainer.windowId = (Integer) this.data.get(0);
                    break;
            }
            break;
        case C_BEGIN_CRYOGENIC_SLEEP:
            pos = (BlockPos) this.data.get(0);
            tile = player.worldObj.getTileEntity(pos);
            if (tile instanceof TileEntityCryogenicChamber) {
                ((TileEntityCryogenicChamber) tile).sleepInBedAt(player, pos.getX(), pos.getY(), pos.getZ());
            }
        default:
            break;
    }
}
Also used : Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) TileEntityCryogenicChamber(micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityCryogenicChamber) GuiLaunchControllerAdvanced(micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiLaunchControllerAdvanced) GuiSlimelingInventory(micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiSlimelingInventory) EntityCargoRocket(micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket) TileEntity(net.minecraft.tileentity.TileEntity) EntitySlimeling(micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling) BlockPos(net.minecraft.util.BlockPos) GuiCargoRocket(micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiCargoRocket) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) TileEntityLaunchController(micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityLaunchController) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

TileEntityCryogenicChamber (micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityCryogenicChamber)2 TileEntity (net.minecraft.tileentity.TileEntity)2 BlockPos (net.minecraft.util.BlockPos)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 TileEntityMulti (micdoodle8.mods.galacticraft.core.tile.TileEntityMulti)1 GuiCargoRocket (micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiCargoRocket)1 GuiLaunchControllerAdvanced (micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiLaunchControllerAdvanced)1 GuiSlimelingInventory (micdoodle8.mods.galacticraft.planets.mars.client.gui.GuiSlimelingInventory)1 EntityCargoRocket (micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket)1 EntitySlimeling (micdoodle8.mods.galacticraft.planets.mars.entities.EntitySlimeling)1 TileEntityLaunchController (micdoodle8.mods.galacticraft.planets.mars.tile.TileEntityLaunchController)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 Entity (net.minecraft.entity.Entity)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1