Search in sources :

Example 1 with EntityLander

use of micdoodle8.mods.galacticraft.core.entities.EntityLander in project Galacticraft by micdoodle8.

the class TeleportTypeMoon method onSpaceDimensionChanged.

@Override
public void onSpaceDimensionChanged(World newWorld, EntityPlayerMP player, boolean ridingAutoRocket) {
    GCPlayerStats stats = GCPlayerStats.get(player);
    if (!ridingAutoRocket && !ConfigManagerCore.disableLander && stats.getTeleportCooldown() <= 0) {
        if (player.capabilities.isFlying) {
            player.capabilities.isFlying = false;
        }
        EntityLander lander = new EntityLander(player);
        lander.setPosition(player.posX, player.posY, player.posZ);
        if (!newWorld.isRemote) {
            lander.forceSpawn = true;
            newWorld.spawnEntityInWorld(lander);
        }
        stats.setTeleportCooldown(10);
    }
}
Also used : GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) EntityLander(micdoodle8.mods.galacticraft.core.entities.EntityLander)

Example 2 with EntityLander

use of micdoodle8.mods.galacticraft.core.entities.EntityLander 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 3 with EntityLander

use of micdoodle8.mods.galacticraft.core.entities.EntityLander in project Galacticraft by micdoodle8.

the class OverlayLander method renderLanderOverlay.

/**
 * Render the GUI when player is in inventory
 */
public static void renderLanderOverlay() {
    OverlayLander.screenTicks++;
    final ScaledResolution scaledresolution = ClientUtil.getScaledRes(minecraft, OverlayLander.minecraft.displayWidth, OverlayLander.minecraft.displayHeight);
    final int width = scaledresolution.getScaledWidth();
    final int height = scaledresolution.getScaledHeight();
    OverlayLander.minecraft.entityRenderer.setupOverlayRendering();
    GL11.glPushMatrix();
    GL11.glScalef(2.0F, 2.0F, 0.0F);
    if (OverlayLander.minecraft.thePlayer.ridingEntity.motionY < -2.0) {
        OverlayLander.minecraft.fontRendererObj.drawString(GCCoreUtil.translate("gui.warning"), width / 4 - OverlayLander.minecraft.fontRendererObj.getStringWidth(GCCoreUtil.translate("gui.warning")) / 2, height / 8 - 20, ColorUtil.to32BitColor(255, 255, 0, 0));
        final int alpha = (int) (255 * Math.sin(OverlayLander.screenTicks / 20.0F));
        final String press1 = GCCoreUtil.translate("gui.lander.warning2");
        final String press2 = GCCoreUtil.translate("gui.lander.warning3");
        OverlayLander.minecraft.fontRendererObj.drawString(press1 + GameSettings.getKeyDisplayString(KeyHandlerClient.spaceKey.getKeyCode()) + press2, width / 4 - OverlayLander.minecraft.fontRendererObj.getStringWidth(press1 + GameSettings.getKeyDisplayString(KeyHandlerClient.spaceKey.getKeyCode()) + press2) / 2, height / 8, ColorUtil.to32BitColor(alpha, alpha, alpha, alpha));
    }
    GL11.glPopMatrix();
    if (OverlayLander.minecraft.thePlayer.ridingEntity.motionY != 0.0D) {
        String string = GCCoreUtil.translate("gui.lander.velocity") + ": " + Math.round(((EntityLander) OverlayLander.minecraft.thePlayer.ridingEntity).motionY * 1000) / 100.0D + " " + GCCoreUtil.translate("gui.lander.velocityu");
        int color = ColorUtil.to32BitColor(255, (int) Math.floor(Math.abs(OverlayLander.minecraft.thePlayer.ridingEntity.motionY) * 51.0D), 255 - (int) Math.floor(Math.abs(OverlayLander.minecraft.thePlayer.ridingEntity.motionY) * 51.0D), 0);
        OverlayLander.minecraft.fontRendererObj.drawString(string, width / 2 - OverlayLander.minecraft.fontRendererObj.getStringWidth(string) / 2, height / 3, color);
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) EntityLander(micdoodle8.mods.galacticraft.core.entities.EntityLander)

Aggregations

EntityLander (micdoodle8.mods.galacticraft.core.entities.EntityLander)3 EntityAutoRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket)1 EntitySpaceshipBase (micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase)1 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)1 GuiNewSpaceRace (micdoodle8.mods.galacticraft.core.client.gui.screen.GuiNewSpaceRace)1 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)1 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)1 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)1 Minecraft (net.minecraft.client.Minecraft)1 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)1 GuiIngameMenu (net.minecraft.client.gui.GuiIngameMenu)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1