Search in sources :

Example 6 with EntityAutoRocket

use of micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket 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 7 with EntityAutoRocket

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

the class EntityTieredRocket method onReachAtmosphere.

@Override
public void onReachAtmosphere() {
    // Launch controlled
    if (this.destinationFrequency != -1) {
        if (this.worldObj.isRemote) {
            // stop the sounds on the client - but do not reset, the rocket may start again
            this.stopRocketSound();
            return;
        }
        this.setTarget(true, this.destinationFrequency);
        if (this.targetVec != null) {
            if (this.targetDimension != this.worldObj.provider.getDimensionId()) {
                WorldProvider targetDim = WorldUtil.getProviderForDimensionServer(this.targetDimension);
                if (targetDim != null && targetDim.worldObj instanceof WorldServer) {
                    boolean dimensionAllowed = this.targetDimension == ConfigManagerCore.idDimensionOverworld;
                    if (targetDim instanceof IGalacticraftWorldProvider) {
                        if (((IGalacticraftWorldProvider) targetDim).canSpaceshipTierPass(this.getRocketTier()))
                            dimensionAllowed = true;
                        else
                            dimensionAllowed = false;
                    } else // No rocket flight to non-Galacticraft dimensions other than the Overworld allowed unless config
                    if ((this.targetDimension > 1 || this.targetDimension < -1) && marsConfigAllDimsAllowed != null) {
                        try {
                            if (marsConfigAllDimsAllowed.getBoolean(null)) {
                                dimensionAllowed = true;
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                    if (dimensionAllowed) {
                        if (this.riddenByEntity != null) {
                            WorldUtil.transferEntityToDimension(this.riddenByEntity, this.targetDimension, (WorldServer) targetDim.worldObj, false, this);
                        } else {
                            Entity e = WorldUtil.transferEntityToDimension(this, this.targetDimension, (WorldServer) targetDim.worldObj, false, null);
                            if (e instanceof EntityAutoRocket) {
                                e.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5f);
                                ((EntityAutoRocket) e).setLaunchPhase(EnumLaunchPhase.LANDING);
                                ((EntityAutoRocket) e).setWaitForPlayer(false);
                            } else {
                                GCLog.info("Error: failed to recreate the unmanned rocket in landing mode on target planet.");
                                e.setDead();
                                this.setDead();
                            }
                        }
                        return;
                    }
                }
            // No destination world found - in this situation continue into regular take-off (as if Not launch controlled)
            } else {
                // Same dimension controlled rocket flight
                this.setPosition(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5F);
                // Stop any lateral motion, otherwise it will update to an incorrect x,z position first tick after spawning above target
                this.motionX = this.motionZ = 0.0D;
                // Small upward motion initially, to keep clear of own flame trail from launch
                this.motionY = 0.1D;
                if (this.riddenByEntity != null) {
                    WorldUtil.forceMoveEntityToPos(this.riddenByEntity, (WorldServer) this.worldObj, new Vector3(this.targetVec.getX() + 0.5F, this.targetVec.getY() + 800, this.targetVec.getZ() + 0.5F), false);
                    this.setWaitForPlayer(true);
                    GCLog.debug("Rocket repositioned, waiting for player");
                }
                this.setLaunchPhase(EnumLaunchPhase.LANDING);
                // Do not destroy the rocket, we still need it!
                return;
            }
        } else {
            // Launch controlled launch but no valid target frequency = rocket loss [INVESTIGATE]
            GCLog.info("Error: the launch controlled rocket failed to find a valid landing spot when it reached space.");
            this.fuelTank.drain(Integer.MAX_VALUE, true);
            this.posY = Math.max(255, (this.worldObj.provider instanceof IExitHeight ? ((IExitHeight) this.worldObj.provider).getYCoordinateToTeleport() : 1200) - 200);
            return;
        }
    }
    // Not launch controlled
    if (!this.worldObj.isRemote) {
        if (this.riddenByEntity instanceof EntityPlayerMP) {
            EntityPlayerMP player = (EntityPlayerMP) this.riddenByEntity;
            this.onTeleport(player);
            GCPlayerStats stats = GCPlayerStats.get(player);
            WorldUtil.toCelestialSelection(player, stats, this.getRocketTier());
        }
        // Destroy any rocket which reached the top of the atmosphere and is not controlled by a Launch Controller
        this.setDead();
    }
// Client side, non-launch controlled, do nothing - no reason why it can't continue flying until the GUICelestialSelection activates
}
Also used : ICameraZoomEntity(micdoodle8.mods.galacticraft.api.entity.ICameraZoomEntity) Entity(net.minecraft.entity.Entity) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) WorldProvider(net.minecraft.world.WorldProvider) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) GCPlayerStats(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats) WorldServer(net.minecraft.world.WorldServer) Vector3(micdoodle8.mods.galacticraft.api.vector.Vector3) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) IExitHeight(micdoodle8.mods.galacticraft.api.world.IExitHeight)

Example 8 with EntityAutoRocket

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

the class GCPlayerHandler method checkOxygen.

protected void checkOxygen(EntityPlayerMP player, GCPlayerStats stats) {
    if ((player.dimension == 0 || player.worldObj.provider instanceof IGalacticraftWorldProvider) && (!(player.dimension == 0 || ((IGalacticraftWorldProvider) player.worldObj.provider).hasBreathableAtmosphere()) || player.posY > GCPlayerHandler.OXYGENHEIGHTLIMIT) && !player.capabilities.isCreativeMode && !(player.ridingEntity instanceof EntityLanderBase) && !(player.ridingEntity instanceof EntityAutoRocket) && !(player.ridingEntity instanceof EntityCelestialFake) && !CompatibilityManager.isAndroid(player)) {
        final ItemStack tankInSlot = stats.getExtendedInventory().getStackInSlot(2);
        final ItemStack tankInSlot2 = stats.getExtendedInventory().getStackInSlot(3);
        final int drainSpacing = OxygenUtil.getDrainSpacing(tankInSlot, tankInSlot2);
        if (tankInSlot == null) {
            stats.setAirRemaining(0);
        } else {
            stats.setAirRemaining(tankInSlot.getMaxDamage() - tankInSlot.getItemDamage());
        }
        if (tankInSlot2 == null) {
            stats.setAirRemaining2(0);
        } else {
            stats.setAirRemaining2(tankInSlot2.getMaxDamage() - tankInSlot2.getItemDamage());
        }
        if (drainSpacing > 0) {
            if ((player.ticksExisted - 1) % drainSpacing == 0 && !OxygenUtil.isAABBInBreathableAirBlock(player) && !stats.isUsingPlanetSelectionGui()) {
                int toTake = 1;
                // Take 1 oxygen from Tank 1
                if (stats.getAirRemaining() > 0) {
                    tankInSlot.damageItem(1, player);
                    stats.setAirRemaining(stats.getAirRemaining() - 1);
                    toTake = 0;
                }
                // Alternatively, take 1 oxygen from Tank 2
                if (toTake > 0 && stats.getAirRemaining2() > 0) {
                    tankInSlot2.damageItem(1, player);
                    stats.setAirRemaining2(stats.getAirRemaining2() - 1);
                    toTake = 0;
                }
            }
        } else {
            if ((player.ticksExisted - 1) % 60 == 0) {
                if (OxygenUtil.isAABBInBreathableAirBlock(player)) {
                    if (stats.getAirRemaining() < 90 && tankInSlot != null) {
                        stats.setAirRemaining(Math.min(stats.getAirRemaining() + 1, tankInSlot.getMaxDamage() - tankInSlot.getItemDamage()));
                    }
                    if (stats.getAirRemaining2() < 90 && tankInSlot2 != null) {
                        stats.setAirRemaining2(Math.min(stats.getAirRemaining2() + 1, tankInSlot2.getMaxDamage() - tankInSlot2.getItemDamage()));
                    }
                } else {
                    if (stats.getAirRemaining() > 0) {
                        stats.setAirRemaining(stats.getAirRemaining() - 1);
                    }
                    if (stats.getAirRemaining2() > 0) {
                        stats.setAirRemaining2(stats.getAirRemaining2() - 1);
                    }
                }
            }
        }
        final boolean airEmpty = stats.getAirRemaining() <= 0 && stats.getAirRemaining2() <= 0;
        if (player.isOnLadder()) {
            stats.setOxygenSetupValid(stats.isLastOxygenSetupValid());
        } else {
            stats.setOxygenSetupValid(!((!OxygenUtil.hasValidOxygenSetup(player) || airEmpty) && !OxygenUtil.isAABBInBreathableAirBlock(player)));
        }
        if (!player.worldObj.isRemote && player.isEntityAlive()) {
            if (!stats.isOxygenSetupValid()) {
                GCCoreOxygenSuffocationEvent suffocationEvent = new GCCoreOxygenSuffocationEvent.Pre(player);
                MinecraftForge.EVENT_BUS.post(suffocationEvent);
                if (!suffocationEvent.isCanceled()) {
                    if (stats.getDamageCounter() == 0) {
                        stats.setDamageCounter(ConfigManagerCore.suffocationCooldown);
                        player.attackEntityFrom(DamageSourceGC.oxygenSuffocation, ConfigManagerCore.suffocationDamage * (2 + stats.getIncrementalDamage()) / 2);
                        if (ConfigManagerCore.hardMode)
                            stats.setIncrementalDamage(stats.getIncrementalDamage() + 1);
                        GCCoreOxygenSuffocationEvent suffocationEventPost = new GCCoreOxygenSuffocationEvent.Post(player);
                        MinecraftForge.EVENT_BUS.post(suffocationEventPost);
                    }
                } else
                    stats.setOxygenSetupValid(true);
            } else
                stats.setIncrementalDamage(0);
        }
    } else if ((player.ticksExisted - 1) % 20 == 0 && !player.capabilities.isCreativeMode && stats.getAirRemaining() < 90) {
        stats.setAirRemaining(stats.getAirRemaining() + 1);
        stats.setAirRemaining2(stats.getAirRemaining2() + 1);
    } else if (player.capabilities.isCreativeMode) {
        stats.setAirRemaining(90);
        stats.setAirRemaining2(90);
    } else {
        stats.setOxygenSetupValid(true);
    }
}
Also used : EntityLanderBase(micdoodle8.mods.galacticraft.core.entities.EntityLanderBase) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) EntityCelestialFake(micdoodle8.mods.galacticraft.core.entities.EntityCelestialFake) GCCoreOxygenSuffocationEvent(micdoodle8.mods.galacticraft.api.event.oxygen.GCCoreOxygenSuffocationEvent) EntityAutoRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket) ItemStack(net.minecraft.item.ItemStack) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint) Footprint(micdoodle8.mods.galacticraft.core.wrappers.Footprint)

Example 9 with EntityAutoRocket

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

the class OverlayDockingRocket method renderDockingOverlay.

/**
 * Render the GUI when player is docking a vehicle
 */
public static void renderDockingOverlay() {
    OverlayDockingRocket.screenTicks++;
    final ScaledResolution scaledresolution = ClientUtil.getScaledRes(OverlayDockingRocket.minecraft, OverlayDockingRocket.minecraft.displayWidth, OverlayDockingRocket.minecraft.displayHeight);
    final int width = scaledresolution.getScaledWidth();
    final int height = scaledresolution.getScaledHeight();
    OverlayDockingRocket.minecraft.entityRenderer.setupOverlayRendering();
    if (OverlayDockingRocket.minecraft.thePlayer.ridingEntity instanceof EntityAutoRocket) {
        EntityAutoRocket rocket = (EntityAutoRocket) OverlayDockingRocket.minecraft.thePlayer.ridingEntity;
        if (rocket.launchPhase == EnumLaunchPhase.LANDING.ordinal() && rocket.targetVec != null) {
            double dX = Math.round((rocket.posX - rocket.targetVec.getX()) * 100.0D) / 100.0D;
            double dY = Math.round((rocket.posY - rocket.targetVec.getY()) * 100.0D) / 100.0D;
            double dZ = Math.round((rocket.posZ - rocket.targetVec.getZ()) * 100.0D) / 100.0D;
            String dXStr = String.valueOf(dX);
            String dYStr = String.valueOf(dY);
            String dZStr = String.valueOf(dZ);
            double targetMotionY = Math.round(Math.max((rocket.posY - rocket.targetVec.getY()) / -100.0D, -0.9D) * 100.0D) / 100.0D;
            double currentMotionY = Math.round(rocket.motionY * 100.0D) / 100.0D;
            double dMY = Math.floor((targetMotionY - currentMotionY) * 300);
            int dMotionY = (int) Math.max(1, Math.min(255, dMY));
            int dMotionYN = (int) Math.max(1, Math.min(255, -dMY));
            String targetMotionYStr = GCCoreUtil.translate("gui.docking_rocket.target_vel.name") + ": " + String.format("%.2f", targetMotionY);
            String currentMotionYStr = GCCoreUtil.translate("gui.docking_rocket.current_vel.name") + ": " + String.format("%.2f", currentMotionY);
            int red = ColorUtil.to32BitColor(dMY > 0 ? 0 : dMotionYN, 255, 255, 255);
            int green = ColorUtil.to32BitColor(dMY < 0 ? 0 : dMotionY, 255, 255, 255);
            int grey = ColorUtil.to32BitColor(255, 220, 220, 220);
            // if (dMY > 25)
            // {
            // String warning = GCCoreUtil.translateWithFormat("gui.docking_rocket.warning.name.0", GameSettings.getKeyDisplayString(KeyHandlerClient.spaceKey.getKeyCode()));
            // OverlayDockingRocket.minecraft.fontRendererObj.drawString(warning, width / 2 - OverlayDockingRocket.minecraft.fontRendererObj.getStringWidth(warning) / 2, height / 3 - 50, green);
            // }
            // else if (dMY < -25)
            // {
            // String warning2 = GCCoreUtil.translateWithFormat("gui.docking_rocket.warning.name.1", GameSettings.getKeyDisplayString(KeyHandlerClient.leftShiftKey.getKeyCode()));
            // OverlayDockingRocket.minecraft.fontRendererObj.drawString(warning2, width / 2 - OverlayDockingRocket.minecraft.fontRendererObj.getStringWidth(warning2) / 2, height / 3 - 35, red);
            // }
            OverlayDockingRocket.minecraft.fontRendererObj.drawString(targetMotionYStr, width - OverlayDockingRocket.minecraft.fontRendererObj.getStringWidth(targetMotionYStr) - 50, height / 3 + 50, grey);
            OverlayDockingRocket.minecraft.fontRendererObj.drawString(currentMotionYStr, width - OverlayDockingRocket.minecraft.fontRendererObj.getStringWidth(currentMotionYStr) - 50, height / 3 + 35, grey);
            OverlayDockingRocket.minecraft.fontRendererObj.drawString(GCCoreUtil.translate("gui.docking_rocket.distance_from.name"), 50, height / 3 + 15, grey);
            OverlayDockingRocket.minecraft.fontRendererObj.drawString("X: " + dXStr, 50, height / 3 + 35, Math.abs(dX) > 15 ? red : grey);
            OverlayDockingRocket.minecraft.fontRendererObj.drawString("Y: " + dYStr, 50, height / 3 + 45, Math.abs(dY) > 50 || Math.abs(dY) < 1.9 ? grey : OverlayDockingRocket.screenTicks / 10 % 2 == 0 ? red : grey);
            OverlayDockingRocket.minecraft.fontRendererObj.drawString("Z: " + dZStr, 50, height / 3 + 55, Math.abs(dZ) > 15 ? red : grey);
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) EntityAutoRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket)

Example 10 with EntityAutoRocket

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

the class EventHandlerGC method onEntityFall.

@SubscribeEvent
public void onEntityFall(LivingFallEvent event) {
    if (event.entityLiving instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) event.entityLiving;
        if (player.ridingEntity instanceof EntityAutoRocket || player.ridingEntity instanceof EntityLanderBase) {
            event.distance = 0.0F;
            event.setCanceled(true);
            return;
        }
    }
    if (event.entityLiving.worldObj.provider instanceof IGalacticraftWorldProvider) {
        event.distance *= ((IGalacticraftWorldProvider) event.entityLiving.worldObj.provider).getFallDamageModifier();
    }
}
Also used : EntityLanderBase(micdoodle8.mods.galacticraft.core.entities.EntityLanderBase) IGalacticraftWorldProvider(micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EntityAutoRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityAutoRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket)9 EntitySpaceshipBase (micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase)4 IGalacticraftWorldProvider (micdoodle8.mods.galacticraft.api.world.IGalacticraftWorldProvider)4 Entity (net.minecraft.entity.Entity)4 Vector3 (micdoodle8.mods.galacticraft.api.vector.Vector3)3 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)3 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)3 ItemStack (net.minecraft.item.ItemStack)3 EntityTieredRocket (micdoodle8.mods.galacticraft.api.prefab.entity.EntityTieredRocket)2 EntityBuggy (micdoodle8.mods.galacticraft.core.entities.EntityBuggy)2 EntityCelestialFake (micdoodle8.mods.galacticraft.core.entities.EntityCelestialFake)2 EntityLanderBase (micdoodle8.mods.galacticraft.core.entities.EntityLanderBase)2 IControllableEntity (micdoodle8.mods.galacticraft.core.entities.IControllableEntity)2 GCPlayerStats (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStats)2 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)2 PacketSimple (micdoodle8.mods.galacticraft.core.network.PacketSimple)2 EntityCargoRocket (micdoodle8.mods.galacticraft.planets.mars.entities.EntityCargoRocket)2 EntityTier2Rocket (micdoodle8.mods.galacticraft.planets.mars.entities.EntityTier2Rocket)2 WorldServer (net.minecraft.world.WorldServer)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2