Search in sources :

Example 16 with ScaledResolution

use of net.minecraft.client.gui.ScaledResolution in project PneumaticCraft by MineMaarten.

the class GuiHelmetMainScreen method init.

public static void init() {
    instance = new GuiHelmetMainScreen();
    Minecraft minecraft = FMLClientHandler.instance().getClient();
    ScaledResolution scaledresolution = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
    int width = scaledresolution.getScaledWidth();
    int height = scaledresolution.getScaledHeight();
    instance.setWorldAndResolution(minecraft, width, height);
    for (int i = 1; i < instance.upgradePages.size(); i++) {
        page = i;
        instance.initGui();
    }
    page = 0;
    instance.init = false;
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) Minecraft(net.minecraft.client.Minecraft)

Example 17 with ScaledResolution

use of net.minecraft.client.gui.ScaledResolution in project PneumaticCraft by MineMaarten.

the class RenderOutFrustrumTriangle method renderTriangle.

public static void renderTriangle(Entity entity) {
    double playerYaw = -RenderManager.instance.playerViewY;
    while (playerYaw >= 360D) {
        playerYaw -= 360;
    }
    while (playerYaw < 0) {
        playerYaw += 360;
    }
    double angle = playerYaw * Math.sin(Math.toRadians(RenderManager.instance.viewerPosX));
    //  double angle = playerYaw;
    // System.out.println("viewY: " + RenderManager.instance.playerViewY);
    ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
    int middleX = sr.getScaledWidth() / 2;
    int middleY = sr.getScaledHeight() / 2;
    int triangleX;
    int triangleY;
    double switchAngle = Math.toDegrees(Math.atan((double) middleX / middleY));
    // System.out.println("angle: " + angle + ", switch angle: " + switchAngle);
    float triangleAngle = 0;
    int distanceFromEdge = 1;
    if (angle < switchAngle) {
        triangleY = distanceFromEdge;
        triangleX = middleX + (int) (Math.tan(Math.toRadians(angle)) * middleY);
    } else if (angle > 360 - switchAngle) {
        triangleY = distanceFromEdge;
        triangleX = middleX - (int) (Math.tan(Math.toRadians(360 - angle)) * middleY);
    } else if (angle < 180 - switchAngle) {
        triangleAngle = 90;
        triangleX = sr.getScaledWidth() - distanceFromEdge;
        triangleY = middleY - (int) (Math.tan(Math.toRadians(90 - angle)) * middleX);
    } else if (angle < 180 + switchAngle) {
        triangleAngle = 180;
        triangleY = sr.getScaledHeight() - distanceFromEdge;
        triangleX = middleX + (int) (Math.tan(Math.toRadians(180 - angle)) * middleY);
    } else {
        triangleAngle = 270;
        triangleX = distanceFromEdge;
        triangleY = middleY + (int) (Math.tan(Math.toRadians(270 - angle)) * middleX);
    }
    Tessellator tessellator = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    // GL11.glEnable(GL11.GL_BLEND);
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glLineWidth(2.0F);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glTranslated(triangleX, triangleY, 0);
    GL11.glRotatef(triangleAngle, 0, 0, 1);
    tessellator.startDrawing(GL11.GL_LINE_LOOP);
    tessellator.addVertex(5, 5, -90F);
    tessellator.addVertex(15, 5, -90F);
    tessellator.addVertex(10, 0, -90F);
    tessellator.draw();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) Tessellator(net.minecraft.client.renderer.Tessellator)

Example 18 with ScaledResolution

use of net.minecraft.client.gui.ScaledResolution in project PneumaticCraft by MineMaarten.

the class SearchUpgradeHandler method getAnimatedStat.

@Override
@SideOnly(Side.CLIENT)
public GuiAnimatedStat getAnimatedStat() {
    if (searchInfo == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
        searchInfo = new GuiAnimatedStat(null, "Currently searching for:", new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_SEARCH_DAMAGE), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided);
        searchInfo.setMinDimensionsAndReset(0, 0);
    }
    return searchInfo;
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiAnimatedStat(pneumaticCraft.client.gui.widget.GuiAnimatedStat) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 19 with ScaledResolution

use of net.minecraft.client.gui.ScaledResolution in project PneumaticCraft by MineMaarten.

the class BlockTrackUpgradeHandler method getAnimatedStat.

@Override
public GuiAnimatedStat getAnimatedStat() {
    if (blockTrackInfo == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
        blockTrackInfo = new GuiAnimatedStat(null, "Current tracked blocks:", new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_BLOCK_TRACKER), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided);
        blockTrackInfo.setMinDimensionsAndReset(0, 0);
    }
    return blockTrackInfo;
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiAnimatedStat(pneumaticCraft.client.gui.widget.GuiAnimatedStat) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft)

Example 20 with ScaledResolution

use of net.minecraft.client.gui.ScaledResolution in project PneumaticCraft by MineMaarten.

the class EntityTrackUpgradeHandler method getAnimatedStat.

@Override
@SideOnly(Side.CLIENT)
public GuiAnimatedStat getAnimatedStat() {
    if (entityTrackInfo == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
        entityTrackInfo = new GuiAnimatedStat(null, "Current tracked entities:", new ItemStack(Itemss.machineUpgrade, 1, ItemMachineUpgrade.UPGRADE_ENTITY_TRACKER), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided);
        entityTrackInfo.setMinDimensionsAndReset(0, 0);
    }
    return entityTrackInfo;
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiAnimatedStat(pneumaticCraft.client.gui.widget.GuiAnimatedStat) ItemStack(net.minecraft.item.ItemStack) Minecraft(net.minecraft.client.Minecraft) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

ScaledResolution (net.minecraft.client.gui.ScaledResolution)29 Minecraft (net.minecraft.client.Minecraft)15 ItemStack (net.minecraft.item.ItemStack)8 GuiAnimatedStat (pneumaticCraft.client.gui.widget.GuiAnimatedStat)5 Rectangle (java.awt.Rectangle)4 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)4 SideOnly (cpw.mods.fml.relauncher.SideOnly)3 FontRenderer (net.minecraft.client.gui.FontRenderer)3 Tessellator (net.minecraft.client.renderer.Tessellator)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 IGuiAnimatedStat (pneumaticCraft.api.client.IGuiAnimatedStat)3 ArrayList (java.util.ArrayList)2 AMVector2 (am2.api.math.AMVector2)1 IBoundItem (am2.items.IBoundItem)1 ItemSpellBook (am2.items.ItemSpellBook)1 IGuideItem (amerifrance.guideapi.api.IGuideItem)1 IGuideLinked (amerifrance.guideapi.api.IGuideLinked)1 IInfoRenderer (amerifrance.guideapi.api.IInfoRenderer)1 Book (amerifrance.guideapi.api.impl.Book)1 CategoryAbstract (amerifrance.guideapi.api.impl.abstraction.CategoryAbstract)1