Search in sources :

Example 71 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project Galacticraft by micdoodle8.

the class TileEntityPlatform method getYOffset.

@SideOnly(Side.CLIENT)
public float getYOffset(float partialTicks) {
    if (this.moving) {
        EntityPlayerSP p = FMLClientHandler.instance().getClientPlayerEntity();
        float playerY = (float) (p.lastTickPosY + (p.posY - p.lastTickPosY) * (double) partialTicks);
        return (playerY - this.pos.getY() - BlockPlatform.HEIGHT);
    } else
        return 0.0F;
}
Also used : EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 72 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project Galacticraft by micdoodle8.

the class TickHandlerClientVenus method onRenderTick.

@SubscribeEvent
public void onRenderTick(RenderTickEvent event) {
    final Minecraft minecraft = FMLClientHandler.instance().getClient();
    final EntityPlayerSP player = minecraft.player;
    final EntityPlayerSP playerBaseClient = PlayerUtil.getPlayerBaseClientFromPlayer(player, false);
    if (event.phase == Phase.END) {
    }
}
Also used : EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) Minecraft(net.minecraft.client.Minecraft) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 73 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project Galacticraft by micdoodle8.

the class OverlaySensorGlasses method renderSensorGlassesValueableBlocks.

public static void renderSensorGlassesValueableBlocks(ItemStack stack, EntityPlayer player, ScaledResolution resolution, float partialTicks) {
    final Iterator<BlockVec3> var51 = ClientProxyCore.valueableBlocks.iterator();
    double var52;
    double var58;
    double var59;
    double var20;
    double var21;
    float var60;
    while (var51.hasNext()) {
        BlockVec3 coords = var51.next();
        var52 = ClientProxyCore.playerPosX - coords.x - 0.5D;
        var58 = ClientProxyCore.playerPosY - coords.y - 0.5D;
        var59 = ClientProxyCore.playerPosZ - coords.z - 0.5D;
        var60 = (float) Math.toDegrees(Math.atan2(var52, var59));
        var20 = Math.sqrt(var52 * var52 + var58 * var58 + var59 * var59) * 0.5D;
        var21 = Math.sqrt(var52 * var52 + var59 * var59) * 0.5D;
        final ScaledResolution var5 = ClientUtil.getScaledRes(OverlaySensorGlasses.minecraft, OverlaySensorGlasses.minecraft.displayWidth, OverlaySensorGlasses.minecraft.displayHeight);
        final int var6 = var5.getScaledWidth();
        final int var7 = var5.getScaledHeight();
        boolean var2 = false;
        final EntityPlayerSP client = PlayerUtil.getPlayerBaseClientFromPlayer(OverlaySensorGlasses.minecraft.player, false);
        if (client != null) {
            GCPlayerStatsClient stats = GCPlayerStatsClient.get(client);
            var2 = stats.isUsingAdvancedGoggles();
        }
        OverlaySensorGlasses.minecraft.fontRenderer.drawString(GCCoreUtil.translate("gui.sensor.advanced") + ": " + (var2 ? GCCoreUtil.translate("gui.sensor.advancedon") : GCCoreUtil.translate("gui.sensor.advancedoff")), var6 / 2 - 50, 4, 0x03b88f);
        try {
            GL11.glPushMatrix();
            if (var20 < 4.0D) {
                GL11.glColor4f(0.0F, 255F / 255F, 198F / 255F, (float) Math.min(1.0D, Math.max(0.2D, (var20 - 1.0D) * 0.1D)));
                FMLClientHandler.instance().getClient().renderEngine.bindTexture(OverlaySensorGlasses.indicatorTexture);
                GL11.glRotatef(-var60 - ClientProxyCore.playerRotationYaw + 180.0F, 0.0F, 0.0F, 1.0F);
                GL11.glTranslated(0.0D, var2 ? -var20 * 16 : -var21 * 16, 0.0D);
                GL11.glRotatef(-(-var60 - ClientProxyCore.playerRotationYaw + 180.0F), 0.0F, 0.0F, 1.0F);
                Overlay.drawCenteringRectangle(var6 / 2, var7 / 2, 1.0D, 8.0D, 8.0D);
            }
        } finally {
            GL11.glPopMatrix();
        }
    }
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GCPlayerStatsClient(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) BlockVec3(micdoodle8.mods.galacticraft.api.vector.BlockVec3)

Example 74 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project Galacticraft by micdoodle8.

the class EventHandlerClient method onRenderPlayerPre.

// Lowest priority to do the PushMatrix last, just before vanilla RenderPlayer - this also means if it gets cancelled first by another mod, this will never be called
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onRenderPlayerPre(RenderPlayerEvent.Pre event) {
    GL11.glPushMatrix();
    final EntityPlayer player = event.getEntityPlayer();
    if (player.getRidingEntity() instanceof ICameraZoomEntity && player == Minecraft.getMinecraft().player && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0) {
        Entity entity = player.getRidingEntity();
        float rotateOffset = ((ICameraZoomEntity) entity).getRotateOffset();
        if (rotateOffset > -10F) {
            rotateOffset += ClientProxyCore.PLAYER_Y_OFFSET;
            GL11.glTranslatef(0, -rotateOffset, 0);
            float anglePitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * event.getPartialRenderTick();
            float angleYaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * event.getPartialRenderTick();
            GL11.glRotatef(-angleYaw, 0.0F, 1.0F, 0.0F);
            GL11.glRotatef(anglePitch, 0.0F, 0.0F, 1.0F);
            GL11.glTranslatef(0, rotateOffset, 0);
        }
    }
    if (player instanceof EntityPlayerSP) {
        sneakRenderOverride = true;
    }
// Gravity - freefall - jetpack changes in player model orientation can go here
}
Also used : ICameraZoomEntity(micdoodle8.mods.galacticraft.api.entity.ICameraZoomEntity) Entity(net.minecraft.entity.Entity) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ICameraZoomEntity(micdoodle8.mods.galacticraft.api.entity.ICameraZoomEntity) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 75 with EntityPlayerSP

use of net.minecraft.client.entity.EntityPlayerSP in project Galacticraft by micdoodle8.

the class KeyHandlerClient method keyDown.

@Override
public void keyDown(Type types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
    if (KeyHandlerClient.mc.player != null && tickEnd) {
        EntityPlayerSP playerBase = PlayerUtil.getPlayerBaseClientFromPlayer(KeyHandlerClient.mc.player, false);
        if (playerBase == null) {
            return;
        }
        GCPlayerStatsClient stats = GCPlayerStatsClient.get(playerBase);
        if (kb.getKeyCode() == KeyHandlerClient.galaxyMap.getKeyCode()) {
            if (KeyHandlerClient.mc.currentScreen == null) {
                KeyHandlerClient.mc.player.openGui(GalacticraftCore.instance, GuiIdsCore.GALAXY_MAP, KeyHandlerClient.mc.world, (int) KeyHandlerClient.mc.player.posX, (int) KeyHandlerClient.mc.player.posY, (int) KeyHandlerClient.mc.player.posZ);
            }
        } else if (kb.getKeyCode() == KeyHandlerClient.openFuelGui.getKeyCode()) {
            if (playerBase.getRidingEntity() instanceof EntitySpaceshipBase || playerBase.getRidingEntity() instanceof EntityBuggy) {
                GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_OPEN_FUEL_GUI, GCCoreUtil.getDimensionID(mc.world), new Object[] { PlayerUtil.getName(playerBase) }));
            }
        } else if (kb.getKeyCode() == KeyHandlerClient.toggleAdvGoggles.getKeyCode()) {
            if (playerBase != null) {
                stats.setUsingAdvancedGoggles(!stats.isUsingAdvancedGoggles());
            }
        }
    }
    if (KeyHandlerClient.mc.player != null && KeyHandlerClient.mc.currentScreen == null) {
        int keyNum = -1;
        if (kb == KeyHandlerClient.accelerateKey) {
            keyNum = 0;
        } else if (kb == KeyHandlerClient.decelerateKey) {
            keyNum = 1;
        } else if (kb == KeyHandlerClient.leftKey) {
            keyNum = 2;
        } else if (kb == KeyHandlerClient.rightKey) {
            keyNum = 3;
        } else if (kb == KeyHandlerClient.spaceKey) {
            keyNum = 4;
        } else if (kb == KeyHandlerClient.leftShiftKey) {
            keyNum = 5;
        }
        Entity entityTest = KeyHandlerClient.mc.player.getRidingEntity();
        if (entityTest != null && entityTest instanceof IControllableEntity && keyNum != -1) {
            IControllableEntity entity = (IControllableEntity) entityTest;
            if (kb.getKeyCode() == KeyHandlerClient.mc.gameSettings.keyBindInventory.getKeyCode()) {
                KeyBinding.setKeyBindState(KeyHandlerClient.mc.gameSettings.keyBindInventory.getKeyCode(), false);
            }
            entity.pressKey(keyNum);
        } else if (entityTest != null && entityTest instanceof EntityAutoRocket) {
            EntityAutoRocket autoRocket = (EntityAutoRocket) entityTest;
            if (autoRocket.launchPhase == EnumLaunchPhase.LANDING.ordinal()) {
                if (kb == KeyHandlerClient.leftShiftKey) {
                    autoRocket.motionY -= 0.02D;
                    GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_SHIP_MOTION_Y, GCCoreUtil.getDimensionID(mc.world), new Object[] { autoRocket.getEntityId(), false }));
                }
                if (kb == KeyHandlerClient.spaceKey) {
                    autoRocket.motionY += 0.02D;
                    GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(EnumSimplePacket.S_UPDATE_SHIP_MOTION_Y, GCCoreUtil.getDimensionID(mc.world), new Object[] { autoRocket.getEntityId(), true }));
                }
            }
        }
    }
}
Also used : EntitySpaceshipBase(micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase) Entity(net.minecraft.entity.Entity) IControllableEntity(micdoodle8.mods.galacticraft.core.entities.IControllableEntity) EntityBuggy(micdoodle8.mods.galacticraft.core.entities.EntityBuggy) GCPlayerStatsClient(micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient) IControllableEntity(micdoodle8.mods.galacticraft.core.entities.IControllableEntity) PacketSimple(micdoodle8.mods.galacticraft.core.network.PacketSimple) EntityAutoRocket(micdoodle8.mods.galacticraft.api.prefab.entity.EntityAutoRocket) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Aggregations

EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)158 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)31 Minecraft (net.minecraft.client.Minecraft)29 ItemStack (net.minecraft.item.ItemStack)29 BlockPos (net.minecraft.util.math.BlockPos)27 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)23 Entity (net.minecraft.entity.Entity)21 EntityPlayer (net.minecraft.entity.player.EntityPlayer)13 TileEntity (net.minecraft.tileentity.TileEntity)13 WorldClient (net.minecraft.client.multiplayer.WorldClient)11 IBlockState (net.minecraft.block.state.IBlockState)10 Tessellator (net.minecraft.client.renderer.Tessellator)10 GCPlayerStatsClient (micdoodle8.mods.galacticraft.core.entities.player.GCPlayerStatsClient)8 ArrayList (java.util.ArrayList)6 Block (net.minecraft.block.Block)6 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)6 Vec3d (net.minecraft.util.math.Vec3d)6 World (net.minecraft.world.World)6 UUID (java.util.UUID)5 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)5