Search in sources :

Example 16 with EntityClientPlayerMP

use of net.minecraft.client.entity.EntityClientPlayerMP in project RFTools by McJty.

the class SkyRenderer method renderSky.

/**
 * Renders the sky with the partial tick time. Args: partialTickTime
 */
@SideOnly(Side.CLIENT)
private static void renderSky(float partialTickTime, DimensionInformation information) {
    initialize();
    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
    WorldClient world = Minecraft.getMinecraft().theWorld;
    TextureManager renderEngine = Minecraft.getMinecraft().getTextureManager();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Vec3 vec3 = world.getSkyColor(player, partialTickTime);
    float skyRed = (float) vec3.xCoord;
    float skyGreen = (float) vec3.yCoord;
    float skyBlue = (float) vec3.zCoord;
    float f6;
    boolean anaglyph = Minecraft.getMinecraft().gameSettings.anaglyph;
    if (anaglyph) {
        float f4 = (skyRed * 30.0F + skyGreen * 59.0F + skyBlue * 11.0F) / 100.0F;
        float f5 = (skyRed * 30.0F + skyGreen * 70.0F) / 100.0F;
        f6 = (skyRed * 30.0F + skyBlue * 70.0F) / 100.0F;
        skyRed = f4;
        skyGreen = f5;
        skyBlue = f6;
    }
    GL11.glColor3f(skyRed, skyGreen, skyBlue);
    Tessellator tessellator = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(skyRed, skyGreen, skyBlue);
    GL11.glCallList(glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    RenderHelper.disableStandardItemLighting();
    float[] sunsetColors = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTickTime), partialTickTime);
    float f7;
    float f8;
    float f9;
    float f10;
    if (sunsetColors != null) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glPushMatrix();
        GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(partialTickTime)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
        f6 = sunsetColors[0];
        f7 = sunsetColors[1];
        f8 = sunsetColors[2];
        float f11;
        if (anaglyph) {
            f9 = (f6 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F;
            f10 = (f6 * 30.0F + f7 * 70.0F) / 100.0F;
            f11 = (f6 * 30.0F + f8 * 70.0F) / 100.0F;
            f6 = f9;
            f7 = f10;
            f8 = f11;
        }
        tessellator.startDrawing(6);
        tessellator.setColorRGBA_F(f6, f7, f8, sunsetColors[3]);
        tessellator.addVertex(0.0D, 100.0D, 0.0D);
        byte b0 = 16;
        tessellator.setColorRGBA_F(sunsetColors[0], sunsetColors[1], sunsetColors[2], 0.0F);
        for (int j = 0; j <= b0; ++j) {
            f11 = j * (float) Math.PI * 2.0F / b0;
            float f12 = MathHelper.sin(f11);
            float f13 = MathHelper.cos(f11);
            tessellator.addVertex((f12 * 120.0F), (f13 * 120.0F), (-f13 * 40.0F * sunsetColors[3]));
        }
        tessellator.draw();
        GL11.glPopMatrix();
        GL11.glShadeModel(GL11.GL_FLAT);
    }
    renderCelestialBodies(partialTickTime, information, world, renderEngine, tessellator);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    double d0 = player.getPosition(partialTickTime).yCoord - world.getHorizon();
    if (d0 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(glSkyList2);
        GL11.glPopMatrix();
        f8 = 1.0F;
        f9 = -((float) (d0 + 65.0D));
        f10 = -f8;
        tessellator.startDrawingQuads();
        tessellator.setColorRGBA_I(0, 255);
        tessellator.addVertex((-f8), f9, f8);
        tessellator.addVertex(f8, f9, f8);
        tessellator.addVertex(f8, f10, f8);
        tessellator.addVertex((-f8), f10, f8);
        tessellator.addVertex((-f8), f10, (-f8));
        tessellator.addVertex(f8, f10, (-f8));
        tessellator.addVertex(f8, f9, (-f8));
        tessellator.addVertex((-f8), f9, (-f8));
        tessellator.addVertex(f8, f10, (-f8));
        tessellator.addVertex(f8, f10, f8);
        tessellator.addVertex(f8, f9, f8);
        tessellator.addVertex(f8, f9, (-f8));
        tessellator.addVertex((-f8), f9, (-f8));
        tessellator.addVertex((-f8), f9, f8);
        tessellator.addVertex((-f8), f10, f8);
        tessellator.addVertex((-f8), f10, (-f8));
        tessellator.addVertex((-f8), f10, (-f8));
        tessellator.addVertex((-f8), f10, f8);
        tessellator.addVertex(f8, f10, f8);
        tessellator.addVertex(f8, f10, (-f8));
        tessellator.draw();
    }
    if (world.provider.isSkyColored()) {
        GL11.glColor3f(skyRed * 0.2F + 0.04F, skyGreen * 0.2F + 0.04F, skyBlue * 0.6F + 0.1F);
    } else {
        GL11.glColor3f(skyRed, skyGreen, skyBlue);
    }
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
    GL11.glCallList(glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}
Also used : TextureManager(net.minecraft.client.renderer.texture.TextureManager) EntityClientPlayerMP(net.minecraft.client.entity.EntityClientPlayerMP) Vec3(net.minecraft.util.Vec3) WorldClient(net.minecraft.client.multiplayer.WorldClient) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 17 with EntityClientPlayerMP

use of net.minecraft.client.entity.EntityClientPlayerMP in project Hbm-s-Nuclear-Tech-GIT by HbmMods.

the class MovingSoundBomber method update.

@Override
public void update() {
    float iVolume = 150;
    if (this.bomber == null || this.bomber.isDead || this.bomber.health <= 0) {
        this.stop();
    } else {
        this.xPosF = (float) bomber.posX;
        this.yPosF = (float) bomber.posY;
        this.zPosF = (float) bomber.posZ;
        EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
        float f = 0;
        if (player != null) {
            f = (float) Math.sqrt(Math.pow(xPosF - player.posX, 2) + Math.pow(yPosF - player.posY, 2) + Math.pow(zPosF - player.posZ, 2));
            volume = (f / iVolume) * -2 + 2;
        } else {
            volume = iVolume;
        }
    }
    if (!Minecraft.getMinecraft().getSoundHandler().isSoundPlaying(this)) {
        stop();
    }
}
Also used : EntityClientPlayerMP(net.minecraft.client.entity.EntityClientPlayerMP)

Example 18 with EntityClientPlayerMP

use of net.minecraft.client.entity.EntityClientPlayerMP in project SecurityCraft by Geforce132.

the class GuiRetinalScannerSetup method actionPerformed.

protected void actionPerformed(GuiButton guibutton) {
    switch(guibutton.id) {
        case 0:
            String players = this.textboxAllowedPlayers.getText();
            World W = Minecraft.getMinecraft().theWorld;
            MinecraftServer minecraftserver = MinecraftServer.getServer();
            try {
                if (this.mc.isSingleplayer()) {
                // String string = "saves/" + BlockRetinalScanner.worldObj.getSaveHandler().getWorldDirectoryName() + "/SecurityCraft/retScanner/players/" + BlockRetinalScanner.lastScannerX + "-" + BlockRetinalScanner.lastScannerY + "-" + BlockRetinalScanner.lastScannerZ;
                // File file = new File(string);
                // file.mkdirs();
                // file.createNewFile();
                // PrintWriter out = new PrintWriter("saves/" + BlockRetinalScanner.worldObj.getSaveHandler().getWorldDirectoryName() + "/SecurityCraft/retScanner/players/" + BlockRetinalScanner.lastScannerX + "-" + BlockRetinalScanner.lastScannerY + "-" + BlockRetinalScanner.lastScannerZ + "/players.txt");
                // out.println(players);
                // out.close();
                } else {
                // String string = minecraftserver.getWorldName() + "/SecurityCraft/retScanner/players/" + BlockRetinalScanner.lastScannerX + "-" + BlockRetinalScanner.lastScannerY + "-" + BlockRetinalScanner.lastScannerZ;
                // File file = new File(string);
                // file.mkdirs();
                // file.createNewFile();
                // PrintWriter out = new PrintWriter(minecraftserver.getWorldName() + "/SecurityCraft/retScanner/players/" + BlockRetinalScanner.lastScannerX + "-" + BlockRetinalScanner.lastScannerY + "-" + BlockRetinalScanner.lastScannerZ + "/players.txt");
                // out.println(players);
                // out.close();
                }
                if (this.mc.isSingleplayer()) {
                    EntityClientPlayerMP P = Minecraft.getMinecraft().thePlayer;
                    P.closeScreen();
                    P.openGui(mod_SecurityCraft.instance, 3, W, (int) P.posX, (int) P.posY, (int) P.posZ);
                } else {
                // HelpfulMethods.closePlayerScreen(BlockRetinalScanner.playerObj);
                // BlockRetinalScanner.playerObj.openGui(mod_SecurityCraft.instance, 3, W, (int) BlockRetinalScanner.playerObj.posX, (int) BlockRetinalScanner.playerObj.posY, (int) BlockRetinalScanner.playerObj.posZ);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            break;
    }
}
Also used : EntityClientPlayerMP(net.minecraft.client.entity.EntityClientPlayerMP) World(net.minecraft.world.World) MinecraftServer(net.minecraft.server.MinecraftServer)

Example 19 with EntityClientPlayerMP

use of net.minecraft.client.entity.EntityClientPlayerMP in project ArsMagica2 by Mithion.

the class AMGuiHelper method overrideKeyboardInput.

public static void overrideKeyboardInput() {
    Minecraft mc = Minecraft.getMinecraft();
    if (mc.thePlayer != null && mc.theWorld != null && ExtendedProperties.For(mc.thePlayer).shouldReverseInput()) {
        EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
        if (mc.gameSettings.keyBindLeft.getIsKeyPressed()) {
            LogHelper.info("Override Left");
            player.movementInput.moveStrafe -= 2;
        }
        if (mc.gameSettings.keyBindRight.getIsKeyPressed()) {
            LogHelper.info("Override Rights");
            player.movementInput.moveStrafe += 2;
        }
        if (mc.thePlayer.isPotionActive(BuffList.scrambleSynapses)) {
            if (mc.gameSettings.keyBindForward.getIsKeyPressed()) {
                player.movementInput.moveForward -= 2;
            }
            if (mc.gameSettings.keyBindBack.getIsKeyPressed()) {
                player.movementInput.moveForward += 2;
            }
        }
    }
}
Also used : EntityClientPlayerMP(net.minecraft.client.entity.EntityClientPlayerMP) Minecraft(net.minecraft.client.Minecraft)

Example 20 with EntityClientPlayerMP

use of net.minecraft.client.entity.EntityClientPlayerMP in project ArsMagica2 by Mithion.

the class AMPacketProcessorClient method handleRemoveBuffEffect.

private void handleRemoveBuffEffect(byte[] data) {
    AMDataReader rdr = new AMDataReader(data, false);
    int buffID = rdr.getInt();
    EntityClientPlayerMP localPlayer = Minecraft.getMinecraft().thePlayer;
    if (buffID == BuffList.temporalAnchor.id) {
        localPlayer.prevTimeInPortal = 1f;
        localPlayer.timeInPortal = 1f;
    } else if (buffID == BuffList.flight.id || buffID == BuffList.levitation.id) {
        localPlayer.capabilities.allowFlying = false;
        localPlayer.capabilities.isFlying = false;
        localPlayer.fallDistance = 0f;
    }
    localPlayer.removePotionEffect(buffID);
}
Also used : EntityClientPlayerMP(net.minecraft.client.entity.EntityClientPlayerMP)

Aggregations

EntityClientPlayerMP (net.minecraft.client.entity.EntityClientPlayerMP)34 Minecraft (net.minecraft.client.Minecraft)8 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)7 ItemStack (net.minecraft.item.ItemStack)6 SideOnly (cpw.mods.fml.relauncher.SideOnly)5 Coordinate (mcjty.lib.varia.Coordinate)3 Tessellator (net.minecraft.client.renderer.Tessellator)3 Item (net.minecraft.item.Item)3 TileEntity (net.minecraft.tileentity.TileEntity)3 GlobalCoordinate (mcjty.lib.varia.GlobalCoordinate)2 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)2 GuiScreen (net.minecraft.client.gui.GuiScreen)2 ClickEvent (net.minecraft.event.ClickEvent)2 HoverEvent (net.minecraft.event.HoverEvent)2 ChatComponentText (net.minecraft.util.ChatComponentText)2 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)2 World (net.minecraft.world.World)2 Vector3 (WayofTime.alchemicalWizardry.api.Vector3)1 IMasterRitualStone (WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone)1 RitualComponent (WayofTime.alchemicalWizardry.api.rituals.RitualComponent)1