本文整理汇总了Java中net.minecraft.client.gui.ScaledResolution.getScaledHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ScaledResolution.getScaledHeight方法的具体用法?Java ScaledResolution.getScaledHeight怎么用?Java ScaledResolution.getScaledHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.gui.ScaledResolution
的用法示例。
在下文中一共展示了ScaledResolution.getScaledHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAchievementWindowScale
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
private void updateAchievementWindowScale()
{
GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
this.width = this.mc.displayWidth;
this.height = this.mc.displayHeight;
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
this.width = scaledresolution.getScaledWidth();
this.height = scaledresolution.getScaledHeight();
GlStateManager.clear(256);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)this.width, (double)this.height, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
}
示例2: drawScreen
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
drawDefaultBackground();
if (dataReceived) {
drawCard();
GL11.glColor4f(1f, 1f, 1f, 1f);
for (int i = 0; i < this.buttons.size(); ++i) {
this.buttons.get(i).drawButton(this.mc, mouseX, mouseY, partialTicks);
}
for (int i = 0; i < this.buttons.size(); ++i) {
if (this.buttons.get(i).isMouseOver()) {
drawHoveringText(TextFormatting.LIGHT_PURPLE + I18n.format(data.get(i).getUnlocalizedName()), mouseX, mouseY);
}
}
} else {
String reading = I18n.format("tarots.reading");
ScaledResolution sr = new ScaledResolution(mc);
int x = ((sr.getScaledWidth() - mc.fontRenderer.getStringWidth(reading)) / 2);
int y = ((sr.getScaledHeight() - mc.fontRenderer.FONT_HEIGHT) / 2);
mc.fontRenderer.drawString(reading, x, y, 0xFCD71C, false);
}
}
示例3: draw
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
public void draw() {
GlStateManager.disableLighting();
ScaledResolution scaled = new ScaledResolution(mc);
int width = scaled.getScaledWidth();
int height = scaled.getScaledHeight();
BlockPos pos = this.entity.getClientActivatedMachine();
ItemStack stack = null;
if (pos != null)
stack = RemoteShellGuiContainer.getItemFromBlock(this.entity, pos);
int x = 4;
int y = 4;
if (stack == null) {
x += drawText("No activated machine. ", x, y, 0xFFAA00);
} else {
x += drawText(stack.getDisplayName()+" ", x, y, 0xFFAA00);
}
this.remoteShellX = x;
this.remoteShellY = y;
x += (this.remoteShellWidth = drawText("Remote Shell ", x, 4, this.remoteShellColor));
x += drawText(this.entity.getEnergyStored(EnumFacing.UP) +" RF ", x, y, 0xff4f63);
}
示例4: refreshScreen
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
protected void refreshScreen() {
ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
int i = scaledresolution.getScaledWidth();
int j = scaledresolution.getScaledHeight();
setWorldAndResolution(Minecraft.getMinecraft(), i, j);
for (IGuiWidget widget : widgets) {
if (widget instanceof GuiAnimatedStat) {
widget.update();
}
}
}
示例5: actionPerformed
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button)
{
if (button.enabled)
{
if (button.id < 200 && button instanceof GuiOptionButton)
{
this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
}
if (button.id == 200)
{
this.mc.gameSettings.saveOptions();
this.mc.displayGuiScreen(this.prevScreen);
}
if (button.id == 210)
{
this.mc.gameSettings.saveOptions();
GuiYesNo guiyesno = new GuiYesNo(this, "Reset all video settings to their default values?", "", 9999);
this.mc.displayGuiScreen(guiyesno);
}
if (button.id != GameSettings.Options.CLOUD_HEIGHT.ordinal())
{
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
int i = scaledresolution.getScaledWidth();
int j = scaledresolution.getScaledHeight();
this.setWorldAndResolution(this.mc, i, j);
}
}
}
示例6: mousePressed
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
ScaledResolution sr = new ScaledResolution(mc);
int left = ((sr.getScaledWidth() - 252) / 2);
int top = ((sr.getScaledHeight() - 192) / 2);
int mxn = mouseX - left;
int myn = mouseY - top;
return mxn >= this.x && myn >= this.y && mxn < this.x + this.width && myn < this.y + this.height;
}
示例7: BackgroundDrawnEvent
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
public BackgroundDrawnEvent(GuiScreen gui)
{
super(gui);
final ScaledResolution scaledresolution = new ScaledResolution(gui.mc);
final int scaledWidth = scaledresolution.getScaledWidth();
final int scaledHeight = scaledresolution.getScaledHeight();
this.mouseX = Mouse.getX() * scaledWidth / gui.mc.displayWidth;
this.mouseY = scaledHeight - Mouse.getY() * scaledHeight / gui.mc.displayHeight - 1;
}
示例8: updateSizes
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
public void updateSizes ( ScaledResolution sr ) {
listWidth = sr . getScaledWidth ( ) - 60 ;
listHeight = ( int ) ( sr . getScaledHeight ( ) * 0.1 ) ;
top = ( int ) ( sr . getScaledHeight ( ) * 0.1) + 15 + 24 ;
bottom =(int) ( ( sr . getScaledHeight ( ) ) - ( sr . getScaledHeight ( ) * 0.1 ) ) - 5 ;
left = 30 ;
slotHeight = itemHeight ;
right = listWidth + this.left;
}
示例9: actionPerformed
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button)
{
if (button.enabled)
{
if (button.id < 200 && button instanceof GuiOptionButton)
{
this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
}
if (button.id == 200)
{
this.mc.gameSettings.saveOptions();
this.mc.displayGuiScreen(this.prevScreen);
}
if (button.id == 210)
{
this.mc.gameSettings.setAllAnimations(true);
}
if (button.id == 211)
{
this.mc.gameSettings.setAllAnimations(false);
}
if (button.id != GameSettings.Options.CLOUD_HEIGHT.ordinal())
{
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
int i = scaledresolution.getScaledWidth();
int j = scaledresolution.getScaledHeight();
this.setWorldAndResolution(this.mc, i, j);
}
}
}
示例10: initGui
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@Override
public void initGui()
{
super.initGui();
this.setGuiSize(mc.displayWidth, mc.displayHeight);
INotebookInfo cap = player.getCapability(INotebookInfo.CAP, null);
if (cap != null)
{
// MC Screen resolution based on GUI scale
ScaledResolution res = new ScaledResolution(mc);
// Size of the notebook when taking the larger scale into account
final int SCALED_NOTEBOOK_WIDTH = (int) (NOTEBOOK_WIDTH * scale);
final int SCALED_NOTEBOOK_HEIGHT = (int) (NOTEBOOK_HEIGHT * scale);
// The start x and y coords of the notebook on the screen
int screenX = (res.getScaledWidth() / 2) - (SCALED_NOTEBOOK_WIDTH / 2);
int screenY = (res.getScaledHeight() / 2) - (SCALED_NOTEBOOK_HEIGHT / 2);
this.searchField = new GuiTextFieldNoShadow(1, mc.fontRenderer, screenX + 27, screenY + 24, 88, 30);
this.searchField.setVisible(true);
this.searchField.setCanLoseFocus(false);
this.searchField.setFocused(true);
this.searchField.setMaxStringLength(50);
this.searchField.setEnableBackgroundDrawing(false);
this.searchField.setText(cap.getSearchKey());
this.searchField.setTextColor(0x000000);
}
}
示例11: drawSplashScreen
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
private void drawSplashScreen(TextureManager textureManagerInstance) throws LWJGLException
{
ScaledResolution scaledresolution = new ScaledResolution(this);
int i = scaledresolution.getScaleFactor();
Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true);
framebuffer.bindFramebuffer(false);
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.disableLighting();
GlStateManager.disableFog();
GlStateManager.disableDepth();
GlStateManager.enableTexture2D();
InputStream inputstream = null;
try
{
inputstream = this.mcDefaultResourcePack.getInputStream(locationMojangPng);
this.mojangLogo = textureManagerInstance.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream)));
textureManagerInstance.bindTexture(this.mojangLogo);
}
catch (IOException ioexception)
{
logger.error((String)("Unable to load logo: " + locationMojangPng), (Throwable)ioexception);
}
finally
{
IOUtils.closeQuietly(inputstream);
}
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos(0.0D, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double)this.displayWidth, (double)this.displayHeight, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos((double)this.displayWidth, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, 0.0D).color(255, 255, 255, 255).endVertex();
tessellator.draw();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int j = 256;
int k = 256;
this.func_181536_a((scaledresolution.getScaledWidth() - j) / 2, (scaledresolution.getScaledHeight() - k) / 2, 0, 0, j, k, 255, 255, 255, 255);
GlStateManager.disableLighting();
GlStateManager.disableFog();
framebuffer.unbindFramebuffer();
framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i);
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
this.updateDisplay();
}
示例12: guiRender
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@SubscribeEvent
public void guiRender(TickEvent.RenderTickEvent t){
Minecraft mc = Minecraft.getMinecraft();
if(mc.inGameHasFocus && !mc.gameSettings.showDebugInfo) {
ScaledResolution res = new ScaledResolution(mc);
int width = res.getScaledWidth();
int height = res.getScaledHeight();
int xPos = 0;
int yPos = 0;
switch(ConfigValues.XALIGNMENT){
case LEFT:
xPos = ConfigValues.COMPASSX;
break;
case RIGHT:
xPos = width-ConfigValues.COMPASSX;
break;
case CENTER:
xPos = width/2+ ConfigValues.COMPASSX;
}
switch(ConfigValues.YALIGNMENT){
case TOP:
yPos = ConfigValues.COMPASSY;
break;
case BOTTOM:
yPos = height-ConfigValues.COMPASSY;
break;
case CENTER:
yPos = height/2+ConfigValues.COMPASSY;
}
glEnable(32826);
GlStateManager.pushMatrix();
RenderHelper.enableGUIStandardItemLighting();
glDisable(GL12.GL_RESCALE_NORMAL);
mc.getRenderItem().renderItemIntoGUI(new ItemStack(UHCCompass.uhccompass), xPos, yPos);
RenderHelper.disableStandardItemLighting();
glEnable(32826);
GlStateManager.popMatrix();
}
}
示例13: renderStackTooltip
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
public static void renderStackTooltip(int x, int y, List<Tuple<ItemStack, String>> tooltipData, Color color, Color colorFade, Color strColor, FontRenderer fr, RenderItem ri) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
if (!tooltipData.isEmpty()) {
int esWidth = 0;
for (Tuple<ItemStack, String> toolTip : tooltipData) {
int width = fr.getStringWidth(toolTip.getSecond()) + 17;
if (width > esWidth)
esWidth = width;
}
ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
if(x + 15 + esWidth > sr.getScaledWidth()) {
x -= esWidth + 24;
}
int sumLineHeight = 8;
int lastAdded = 0;
if (tooltipData.size() > 1) {
sumLineHeight += 2;
for (Tuple<ItemStack, String> tooltipEntry : tooltipData) {
int height = tooltipEntry.getFirst().isEmpty() ? 10 : 17;
sumLineHeight += height;
lastAdded = height;
}
sumLineHeight -= lastAdded;
}
if(y + sumLineHeight > sr.getScaledHeight()) {
y = (sr.getScaledHeight() - sumLineHeight);
y = Math.max(25, y);
}
int pX = x + 12;
int pY = y - 12;
float z = 300F;
GlStateManager.disableDepth();
drawGradientRect(pX - 3, pY - 4, z, pX + esWidth + 3, pY - 3, color, colorFade);
drawGradientRect(pX - 3, pY + sumLineHeight + 3, z, pX + esWidth + 3, pY + sumLineHeight + 4, color, colorFade);
drawGradientRect(pX - 3, pY - 3, z, pX + esWidth + 3, pY + sumLineHeight + 3, color, colorFade);
drawGradientRect(pX - 4, pY - 3, z, pX - 3, pY + sumLineHeight + 3, color, colorFade);
drawGradientRect(pX + esWidth + 3, pY - 3, z, pX + esWidth + 4, pY + sumLineHeight + 3, color, colorFade);
int rgb = color.getRGB();
int col = (rgb & 0x00FFFFFF) | rgb & 0xFF000000;
Color colOp = new Color(col);
drawGradientRect(pX - 3, pY - 3 + 1, z, pX - 3 + 1, pY + sumLineHeight + 3 - 1, color, colOp);
drawGradientRect(pX + esWidth + 2, pY - 3 + 1, z, pX + esWidth + 3, pY + sumLineHeight + 3 - 1, color, colOp);
drawGradientRect(pX - 3, pY - 3, z, pX + esWidth + 3, pY - 3 + 1, colOp, colOp);
drawGradientRect(pX - 3, pY + sumLineHeight + 2, z, pX + esWidth + 3, pY + sumLineHeight + 3, color, color);
for (Tuple<ItemStack, String> stackDesc : tooltipData) {
if(!stackDesc.getFirst().isEmpty()) {
fr.drawString(stackDesc.getSecond(), pX + 17, pY, strColor.getRGB());
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.pushMatrix();
RenderHelper.enableGUIStandardItemLighting();
ri.renderItemAndEffectIntoGUI(stackDesc.getFirst(), pX - 1, pY - 5);
GlStateManager.popMatrix();
pY += 17;
} else {
fr.drawString(stackDesc.getSecond(), pX, pY, strColor.getRGB());
GlStateManager.color(1F, 1F, 1F, 1F);
pY += 10;
}
GlStateManager.enableBlend();
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
}
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.enableDepth();
}
GlStateManager.enableAlpha();
GlStateManager.color(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
}
示例14: getScaledHeight
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
public static int getScaledHeight() {
ScaledResolution r = new ScaledResolution(Minecraft.getMinecraft());
return r.getScaledHeight();
}
示例15: renderOverlay
import net.minecraft.client.gui.ScaledResolution; //导入方法依赖的package包/类
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
if (event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR && renderTime > 0) {
Minecraft mc = Minecraft.getMinecraft();
TextureManager manager = mc.getTextureManager();
Optional<IEnergy> optional = EnergyHandler.getEnergy(mc.player);
if (optional.isPresent()) {
IEnergy energy = optional.get();
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
ScaledResolution resolution = event.getResolution();
double interpEnergy = 0;
if (oldEnergy >= 0) {
interpEnergy = (double) (energy.get() - oldEnergy) * event.getPartialTicks() + oldEnergy;
} else {
interpEnergy = energy.get();
}
double filled = interpEnergy / energy.getMax();
// System.out.println("fil: " + filled + ", chg: " + energy.get() + ", max: " + energy.getMax());
int height = ConfigHandler.ENERGY_HUD.height;
int width = ConfigHandler.ENERGY_HUD.width;
int x = ConfigHandler.ENERGY_HUD.x;
int y = resolution.getScaledHeight() - ConfigHandler.ENERGY_HUD.y;
if (ConfigHandler.ENERGY_HUD.hide) {
GlStateManager.color(1F, 1F, 1F, visible);
}
double barWidth = width * 7 / 25;
GlStateManager.disableCull();
manager.bindTexture(ResourceLocations.ENERGY_BACKGROUND[0]);
renderTexture(x + 9, y + 88, barWidth, -(height - 28D) * filled, 0, filled);
if (visible == 1f) {
GlStateManager.pushMatrix();
GlStateManager.color(1F, 1F, 1F, visible == 1F ? barAlpha : visible);
manager.bindTexture(ResourceLocations.ENERGY_BACKGROUND[1]);
renderTexture(x + 9, y + 88, barWidth, -(height - 28D) * filled, 0, filled);
GlStateManager.enableCull();
GlStateManager.popMatrix();
}
if (ConfigHandler.ENERGY_HUD.hide) {
GlStateManager.color(1F, 1F, 1F, visible);
}
manager.bindTexture(energy.getType().getTexture());
renderTexture(x, y, width, height, 0, 1);
int textColor = 0x990066;
if (ConfigHandler.ENERGY_HUD.hide) {
int alpha = (int) (visible * 255);
textColor = alpha << 24 | 0x990066;
}
String text = "E: " + energy.get();
mc.fontRenderer.drawStringWithShadow(text, x, y - 10, textColor);
GlStateManager.disableBlend();
GlStateManager.popMatrix();
}
}
}