Search in sources :

Example 11 with EntitySpaceshipBase

use of micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase in project Galacticraft by micdoodle8.

the class TickHandlerClient method onRenderTick.

@SubscribeEvent
public void onRenderTick(RenderTickEvent event) {
    final Minecraft minecraft = FMLClientHandler.instance().getClient();
    final EntityPlayerSP player = minecraft.thePlayer;
    final EntityPlayerSP playerBaseClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false);
    if (player == null || playerBaseClient == null) {
        return;
    }
    GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerBaseClient);
    ;
    if (event.phase == Phase.END) {
        if (minecraft.currentScreen instanceof GuiIngameMenu) {
            int i = Mouse.getEventX() * minecraft.currentScreen.width / minecraft.displayWidth;
            int j = minecraft.currentScreen.height - Mouse.getEventY() * minecraft.currentScreen.height / minecraft.displayHeight - 1;
            int k = Mouse.getEventButton();
            if (Minecraft.isRunningOnMac && k == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) {
                k = 1;
            }
            int deltaColor = 0;
            if (i > minecraft.currentScreen.width - 100 && j > minecraft.currentScreen.height - 35) {
                deltaColor = 20;
                if (k == 0) {
                    if (Mouse.getEventButtonState()) {
                        minecraft.displayGuiScreen(new GuiNewSpaceRace(playerBaseClient));
                    }
                }
            }
            this.drawGradientRect(minecraft.currentScreen.width - 100, minecraft.currentScreen.height - 35, minecraft.currentScreen.width, minecraft.currentScreen.height, ColorUtil.to32BitColor(150, 10 + deltaColor, 10 + deltaColor, 10 + deltaColor), ColorUtil.to32BitColor(250, 10 + deltaColor, 10 + deltaColor, 10 + deltaColor));
            minecraft.fontRendererObj.drawString(GCCoreUtil.translate("gui.space_race.create.title.name.0"), minecraft.currentScreen.width - 50 - minecraft.fontRendererObj.getStringWidth(GCCoreUtil.translate("gui.space_race.create.title.name.0")) / 2, minecraft.currentScreen.height - 26, ColorUtil.to32BitColor(255, 240, 240, 240));
            minecraft.fontRendererObj.drawString(GCCoreUtil.translate("gui.space_race.create.title.name.1"), minecraft.currentScreen.width - 50 - minecraft.fontRendererObj.getStringWidth(GCCoreUtil.translate("gui.space_race.create.title.name.1")) / 2, minecraft.currentScreen.height - 16, ColorUtil.to32BitColor(255, 240, 240, 240));
            Gui.drawRect(minecraft.currentScreen.width - 100, minecraft.currentScreen.height - 35, minecraft.currentScreen.width - 99, minecraft.currentScreen.height, ColorUtil.to32BitColor(255, 0, 0, 0));
            Gui.drawRect(minecraft.currentScreen.width - 100, minecraft.currentScreen.height - 35, minecraft.currentScreen.width, minecraft.currentScreen.height - 34, ColorUtil.to32BitColor(255, 0, 0, 0));
        }
        ClientProxyCore.playerPosX = player.prevPosX + (player.posX - player.prevPosX) * event.renderTickTime;
        ClientProxyCore.playerPosY = player.prevPosY + (player.posY - player.prevPosY) * event.renderTickTime;
        ClientProxyCore.playerPosZ = player.prevPosZ + (player.posZ - player.prevPosZ) * event.renderTickTime;
        ClientProxyCore.playerRotationYaw = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * event.renderTickTime;
        ClientProxyCore.playerRotationPitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * event.renderTickTime;
        if (minecraft.currentScreen == null && player.ridingEntity instanceof EntitySpaceshipBase && minecraft.gameSettings.thirdPersonView != 0 && !minecraft.gameSettings.hideGUI) {
            OverlayRocket.renderSpaceshipOverlay(((EntitySpaceshipBase) player.ridingEntity).getSpaceshipGui());
        }
        if (minecraft.currentScreen == null && player.ridingEntity instanceof EntityLander && minecraft.gameSettings.thirdPersonView != 0 && !minecraft.gameSettings.hideGUI) {
            OverlayLander.renderLanderOverlay();
        }
        if (minecraft.currentScreen == null && player.ridingEntity instanceof EntityAutoRocket && minecraft.gameSettings.thirdPersonView != 0 && !minecraft.gameSettings.hideGUI) {
            OverlayDockingRocket.renderDockingOverlay();
        }
        if (minecraft.currentScreen == null && player.ridingEntity instanceof EntitySpaceshipBase && minecraft.gameSettings.thirdPersonView != 0 && !minecraft.gameSettings.hideGUI && ((EntitySpaceshipBase) minecraft.thePlayer.ridingEntity).launchPhase < EnumLaunchPhase.LAUNCHED.ordinal()) {
            OverlayLaunchCountdown.renderCountdownOverlay();
        }
        if (player.worldObj.provider instanceof IGalacticraftWorldProvider && OxygenUtil.shouldDisplayTankGui(minecraft.currentScreen) && OxygenUtil.noAtmosphericCombustion(player.worldObj.provider) && !playerBaseClient.isSpectator() && !minecraft.gameSettings.showDebugInfo) {
            int var6 = (TickHandlerClient.airRemaining - 90) * -1;
            if (TickHandlerClient.airRemaining <= 0) {
                var6 = 90;
            }
            int var7 = (TickHandlerClient.airRemaining2 - 90) * -1;
            if (TickHandlerClient.airRemaining2 <= 0) {
                var7 = 90;
            }
            int thermalLevel = stats.getThermalLevel() + 22;
            OverlayOxygenTanks.renderOxygenTankIndicator(thermalLevel, var6, var7, !ConfigManagerCore.oxygenIndicatorLeft, !ConfigManagerCore.oxygenIndicatorBottom, Math.abs(thermalLevel - 22) >= 10 && !stats.isThermalLevelNormalising());
        }
        if (playerBaseClient != null && player.worldObj.provider instanceof IGalacticraftWorldProvider && !stats.isOxygenSetupValid() && OxygenUtil.noAtmosphericCombustion(player.worldObj.provider) && minecraft.currentScreen == null && !minecraft.gameSettings.hideGUI && !playerBaseClient.capabilities.isCreativeMode && !playerBaseClient.isSpectator()) {
            OverlayOxygenWarning.renderOxygenWarningOverlay();
        }
    }
}
Also used : EntitySpaceshipBase(micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) GCPlayerStatsClient(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient) GuiIngameMenu(net.minecraft.client.gui.GuiIngameMenu) GuiNewSpaceRace(micdoodle8.mods.galacticraft.core.client.gui.screen.GuiNewSpaceRace) EntityAutoRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) Footprint(micdoodle8.mods.galacticraft.core.wrappers.Footprint) EntityLander(micdoodle8.mods.galacticraft.core.entities.EntityLander) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 12 with EntitySpaceshipBase

use of micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase in project Galacticraft by micdoodle8.

the class TransformerHooks method getSkyColorHook.

@SideOnly(Side.CLIENT)
public static Vec3 getSkyColorHook(World world) {
    EntityPlayerSP player = FMLClientHandler.instance().getClient().thePlayer;
    if (world.provider.getSkyRenderer() instanceof SkyProviderOverworld || (player != null && player.posY > Constants.OVERWORLD_CLOUD_HEIGHT && player.ridingEntity instanceof EntitySpaceshipBase)) {
        float f1 = world.getCelestialAngle(1.0F);
        float f2 = MathHelper.cos(f1 * Constants.twoPI) * 2.0F + 0.5F;
        if (f2 < 0.0F) {
            f2 = 0.0F;
        }
        if (f2 > 1.0F) {
            f2 = 1.0F;
        }
        int i = MathHelper.floor_double(player.posX);
        int j = MathHelper.floor_double(player.posY);
        int k = MathHelper.floor_double(player.posZ);
        BlockPos pos = new BlockPos(i, j, k);
        int l = ForgeHooksClient.getSkyBlendColour(world, pos);
        float f4 = (float) (l >> 16 & 255) / 255.0F;
        float f5 = (float) (l >> 8 & 255) / 255.0F;
        float f6 = (float) (l & 255) / 255.0F;
        f4 *= f2;
        f5 *= f2;
        f6 *= f2;
        if (player.posY <= Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) {
            Vec3 vec = world.getSkyColor(FMLClientHandler.instance().getClient().getRenderViewEntity(), 1.0F);
            double blend = (player.posY - Constants.OVERWORLD_CLOUD_HEIGHT) / (Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT - Constants.OVERWORLD_CLOUD_HEIGHT);
            double ablend = 1 - blend;
            return new Vec3(f4 * blend + vec.xCoord * ablend, f5 * blend + vec.yCoord * ablend, f6 * blend + vec.zCoord * ablend);
        } else {
            double blend = Math.min(1.0D, (player.posY - Constants.OVERWORLD_SKYPROVIDER_STARTHEIGHT) / 300.0D);
            double ablend = 1.0D - blend;
            blend /= 255.0D;
            return new Vec3(f4 * ablend + blend * 31.0D, f5 * ablend + blend * 8.0D, f6 * ablend + blend * 99.0D);
        }
    }
    return world.getSkyColor(FMLClientHandler.instance().getClient().getRenderViewEntity(), 1.0F);
}
Also used : EntitySpaceshipBase(micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase) Vec3(net.minecraft.util.Vec3) SkyProviderOverworld(micdoodle8.mods.galacticraft.core.client.SkyProviderOverworld) BlockPos(net.minecraft.util.BlockPos) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

EntitySpaceshipBase (micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase)10 Entity (net.minecraft.entity.Entity)5 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)4 EntityAutoRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket)3 WorldProviderSpaceStation (micdoodle8.mods.galacticraft.core.dimension.WorldProviderSpaceStation)3 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)3 TileEntity (net.minecraft.tileentity.TileEntity)3 BlockPos (net.minecraft.util.BlockPos)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 IFuelDock (micdoodle8.mods.galacticraft.api.tile.IFuelDock)2 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)2 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)2 EntityBuggy (micdoodle8.mods.galacticraft.core.entities.EntityBuggy)2 IControllableEntity (micdoodle8.mods.galacticraft.core.entities.IControllableEntity)2 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)2 FluidNetwork (micdoodle8.mods.galacticraft.core.fluid.FluidNetwork)2 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)2 Minecraft (net.minecraft.client.Minecraft)2 NetworkPlayerInfo (net.minecraft.client.network.NetworkPlayerInfo)2 ResourceLocation (net.minecraft.util.ResourceLocation)2