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;
}
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();
}
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;
}
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;
}
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;
}
Aggregations