Java 类net.minecraft.client.gui.ScaledResolution 实例源码

项目:Loot-Slash-Conquer    文件:GuiMana.java   
@SubscribeEvent
public void onRenderOverlayText(RenderGameOverlayEvent.Text event)
{
    ScaledResolution sr = event.getResolution();
    EntityPlayer player = Minecraft.getMinecraft().player;
    Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null);

    if (!player.capabilities.isCreativeMode && statsCap != null)
    {
        String mana = statsCap.getMana() + " / " + statsCap.getMaxMana();

        GL11.glPushMatrix();
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(mana, (sr.getScaledWidth() / 2 + 37) * 2, (sr.getScaledHeight() - 37) * 2, 0xFFFFFF);
        GL11.glPopMatrix();
    }
}
项目:rezolve    文件:RemoteShellOverlay.java   
@Override
public void onMouseEvent(MouseEvent evt) {

    ScaledResolution scale = new ScaledResolution(this.mc);

    float scaleFactor = scale.getScaledWidth() / (float)this.mc.displayWidth; 
    int mx = (int)(evt.getX() * scaleFactor);
    int my = (int)((this.mc.displayHeight - evt.getY()) * scaleFactor);
    int btn = evt.getButton();

    boolean hitRemoteShell = 
        mx > remoteShellX && mx < remoteShellX + remoteShellWidth
        && my > remoteShellY && my < remoteShellY + fontHeight
    ;

    if (!this.mouseDown && Mouse.isButtonDown(0)) {
        this.mouseDown = true;
        if (hitRemoteShell) {
            System.out.println("You tried to return to the remote shell!");
            this.entity.returnToShell();
        }
    } else {
        this.mouseDown = false;
        this.remoteShellColor = hitRemoteShell ? this.remoteShellColorHover : this.remoteShellColorNormal;
    }
}
项目:Lithium-Forge    文件:NewLithiumGUI.java   
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    //Just get a scaled resolution
    ScaledResolution sr = ModCoderPackUtils.getScaledResolution();


    //Then we draw a background to make it easier to see
    this.drawDefaultBackground();

    //Then, we render all textboxes
    textBoxes.values().forEach(NickGuiTextField::drawTextBox);


    //Then we render all the other stuff
    images.values().forEach(l -> imageRenderer.renderLithiumControl(l, this));
    checkBoxes.values().forEach(c -> checkboxRenderer.renderLithiumControl(c, this));
    progressBars.values().forEach(l -> progressBarRenderer.renderLithiumControl(l, this));
    sliders.values().forEach(l -> sliderRenderer.renderLithiumControl(l, this));
    labels.forEach(l -> textLabelRenderer.renderLithiumControl(l, this));

    super.drawScreen(mouseX, mouseY, partialTicks);
}
项目:Bewitchment    文件:GuiTarots.java   
public void loadData(ArrayList<TarotInfo> fromNetwork) {
    this.data = fromNetwork;
    this.buttons = new ArrayList<TarotButton>(data.size());
    this.setGuiSize(252, 192);
    int t = data.size();
    for (int i = 0; i < t; i++) {
        int qx = ((252 - (22 * t)) / (t + 1)) * (i + 1) + (i * 22);
        TarotButton tb = new TarotButton(i, qx, 160);
        this.buttons.add(tb);
        if (i == 0) {
            tb.setPressed(true);
            pressed = 0;
        }
    }
    dataReceived = true;
    ScaledResolution sr = new ScaledResolution(mc);
    this.onResize(mc, sr.getScaledWidth(), sr.getScaledHeight());
}
项目:Bewitchment    文件:GuiTarots.java   
@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);
    }

}
项目:TextDisplayer    文件:Message.java   
public void render(boolean drawBox) {
    ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
    int width = getStringWidth() + 4;
    int height = 14;

    if (getX() < 0) {
         setX(0);
    } else if (getX() * getScale() > res.getScaledWidth() - width) {
        setX((int) ((res.getScaledWidth() - (width * getScale())) / getScale()));
    }

    if (getY() < 0) {
        setY(0);
    } else if (getY() * getScale() > res.getScaledHeight() - height) {
        setY((int) ((res.getScaledHeight() - (height * getScale())) / getScale()));
    }

    GlStateManager.pushMatrix();
    GlStateManager.scale(getScale(), getScale(), 1.0);
    if (drawBox && !a) {
        Gui.drawRect(getX(), getY(), getX() + width, getY() + height, -1442840576);
    }

    Minecraft.getMinecraft().fontRendererObj.drawString(getMessage(), getX() + 2, getY() + 3, isChroma() ? getColor() : Color.WHITE.getRGB(), useShadow());
    GlStateManager.popMatrix();
}
项目:Anima-Mundi    文件:GuiAnalyser.java   
public void drawGui(float partialTicks)
{
    Minecraft mc = Minecraft.getMinecraft();

    ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
    TileEntity te = getDrawTile(mc);
    int startX = getStartX(res);
    int startY = getStartY(res);

    lastTicks = partialTicks;
    drawBackground(ySize, xSize, startX, startY, res.getScaledWidth(), res.getScaledHeight(), 300, mc.fontRenderer);
    if(shouldDrawInfo())
    {
        drawInfo(te, startX - offsetX, startY - offsetY);
    }

}
项目:CustomWorldGen    文件:GuiIngameForge.java   
private void renderHelmet(ScaledResolution res, float partialTicks)
{
    if (pre(HELMET)) return;

    ItemStack itemstack = this.mc.thePlayer.inventory.armorItemInSlot(3);

    if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() != null)
    {
        if (itemstack.getItem() == Item.getItemFromBlock(Blocks.PUMPKIN))
        {
            renderPumpkinOverlay(res);
        }
        else
        {
            itemstack.getItem().renderHelmetOverlay(itemstack, mc.thePlayer, res, partialTicks);
        }
    }

    post(HELMET);
}
项目:DecompiledMinecraft    文件:GuiAchievement.java   
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);
}
项目:Wurst-MC-1.12    文件:TacoCmd.java   
@Override
public void onRenderGUI()
{
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    if(WurstClient.INSTANCE.mods.rainbowUiMod.isActive())
    {
        float[] acColor = WurstClient.INSTANCE.getGui().getAcColor();
        GL11.glColor4f(acColor[0], acColor[1], acColor[2], 1);
    }else
        GL11.glColor4f(1, 1, 1, 1);

    mc.getTextureManager().bindTexture(tacos[ticks / 8]);
    ScaledResolution sr = new ScaledResolution(mc);
    int x = sr.getScaledWidth() / 2 - 32 + 76;
    int y = sr.getScaledHeight() - 32 - 19;
    int w = 64;
    int h = 32;
    Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, w, h, w, h);

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);
}
项目:BaseClient    文件:GuiQualitySettingsOF.java   
/**
 * 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 != GameSettings.Options.AA_LEVEL.ordinal())
        {
            ScaledResolution scaledresolution = new ScaledResolution(this.mc);
            this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
        }
    }
}
项目:BaseClient    文件:GuiGrabber.java   
public void drawScreen(int x, int y, float par3) {
    GL11.glPushMatrix();
    ScaledResolution scaledRes = new ScaledResolution(this.mc);
    float scale = (float)scaledRes.getScaleFactor() / (float)Math.pow(scaledRes.getScaleFactor(), 2.0);
    GL11.glScalef((float)scale, (float)scale, (float)scale);
    int mouseX = Mouse.getX();
    int mouseY = Display.getHeight() - Mouse.getY();
    Gui.instance.update(mouseX, mouseY);
    Gui.instance.render();
    GL11.glPopMatrix();
    if (Mouse.hasWheel()) {
        int wheel = Mouse.getDWheel();
        this.scrollVelocity = wheel < 0 ? -120 : (wheel > 0 ? 120 : 0);
    }
    Gui.instance.mouseScroll(this.scrollVelocity);
}
项目:Backmemed    文件:GuiAchievement.java   
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);
}
项目:CustomWorldGen    文件:FMLClientHandler.java   
public boolean handleLoadingScreen(ScaledResolution scaledResolution) throws IOException
{
    if (client.currentScreen instanceof GuiNotification)
    {
        int width = scaledResolution.getScaledWidth();
        int height = scaledResolution.getScaledHeight();
        int mouseX = Mouse.getX() * width / client.displayWidth;
        int mouseZ = height - Mouse.getY() * height / client.displayHeight - 1;

        client.currentScreen.drawScreen(mouseX, mouseZ, 0);
        client.currentScreen.handleInput();

        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:GuiQualitySettingsOF.java   
/**
 * 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 != 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);
        }
    }
}
项目:BaseClient    文件:GuiPerformanceSettingsOF.java   
/**
 * 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 != 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);
        }
    }
}
项目:BaseClient    文件:GuiAchievement.java   
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);
}
项目:Loot-Slash-Conquer    文件:GuiMana.java   
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent.Post event)
{
    if (event.getType() != ElementType.EXPERIENCE) return;
    else
    {
        ScaledResolution sr = event.getResolution();
        EntityPlayer player = mc.player;

        if (!player.capabilities.isCreativeMode)
        {
            Stats statsCap = (Stats) player.getCapability(CapabilityPlayerStats.STATS, null);

            if (statsCap != null)
            {
                if (statsCap.getMaxMana() != 0)
                {
                    double manaBarWidth = (double) statsCap.getMana() / statsCap.getMaxMana() * 81.0;
                    int xPos = sr.getScaledWidth() / 2 + 10;
                    int yPos = sr.getScaledHeight() - 38;

                    mc.renderEngine.bindTexture(location);

                    //if (capMana.getMana() != capMana.getMaxMana())
                    //{
                        this.drawTexturedModalRect(xPos, yPos, 0, 18, 81, 6);
                        this.drawTexturedModalRect(xPos, yPos, 0, 24, (int) manaBarWidth, 5);
                    //}
                }
            }
        }
    }
}
项目:CustomWorldGen    文件:Minecraft.java   
/**
 * Called to resize the current screen.
 */
public void resize(int width, int height)
{
    this.displayWidth = Math.max(1, width);
    this.displayHeight = Math.max(1, height);

    if (this.currentScreen != null)
    {
        ScaledResolution scaledresolution = new ScaledResolution(this);
        this.currentScreen.onResize(this, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
    }

    this.loadingScreen = new LoadingScreenRenderer(this);
    this.updateFramebufferSize();
}
项目:Backmemed    文件:Minecraft.java   
/**
 * Called to resize the current screen.
 */
private void resize(int width, int height)
{
    this.displayWidth = Math.max(1, width);
    this.displayHeight = Math.max(1, height);

    if (this.currentScreen != null)
    {
        ScaledResolution scaledresolution = new ScaledResolution(this);
        this.currentScreen.onResize(this, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
    }

    this.loadingScreen = new LoadingScreenRenderer(this);
    this.updateFramebufferSize();
}
项目:rezolve    文件:RemoteShellOverlay.java   
@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);

}
项目:CustomWorldGen    文件:EntityRenderer.java   
/**
 * Setup orthogonal projection for rendering GUI screen overlays
 */
public void setupOverlayRendering()
{
    ScaledResolution scaledresolution = new ScaledResolution(this.mc);
    GlStateManager.clear(256);
    GlStateManager.matrixMode(5889);
    GlStateManager.loadIdentity();
    GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
    GlStateManager.matrixMode(5888);
    GlStateManager.loadIdentity();
    GlStateManager.translate(0.0F, 0.0F, -2000.0F);
}
项目:pnc-repressurized    文件:SearchUpgradeHandler.java   
@Override
@SideOnly(Side.CLIENT)
public GuiAnimatedStat getAnimatedStat() {
    if (searchInfo == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft);
        searchInfo = new GuiAnimatedStat(null, "Currently searching for:", CraftingRegistrator.getUpgrade(EnumUpgrade.SEARCH), statX != -1 ? statX : sr.getScaledWidth() - 2, statY, 0x3000AA00, null, statLeftSided);
        searchInfo.setMinDimensionsAndReset(0, 0);
    }
    return searchInfo;
}
项目:pnc-repressurized    文件:MainHelmetHandler.java   
@Override
@SideOnly(Side.CLIENT)
public IGuiAnimatedStat getAnimatedStat() {
    if (powerStat == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft);
        powerStat = new GuiAnimatedStat(null, "Helmet Pressure: ", "", powerStatX != -1 ? powerStatX : sr.getScaledWidth() - 2, powerStatY, 0x3000AA00, null, powerStatLeftSided);
        powerStat.setMinDimensionsAndReset(0, 0);
        powerStat.openWindow();
    }
    return powerStat;
}
项目:pnc-repressurized    文件:GuiPneumaticContainerBase.java   
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();
        }
    }
}
项目:pnc-repressurized    文件:GuiAnimatedStat.java   
public GuiAnimatedStat(GuiScreen gui, String title, int xPos, int yPos, int backGroundColor,
                       IGuiAnimatedStat affectingStat, boolean leftSided) {
    this.gui = gui;
    baseX = xPos;
    baseY = yPos;
    this.affectingStat = affectingStat;
    width = minWidth;
    height = minHeight;
    this.backGroundColor = backGroundColor;
    setTitle(title);
    texture = "";
    this.leftSided = leftSided;
    if (gui != null) {
        ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
        if (sr.getScaledWidth() < 520) {
            textSize = (sr.getScaledWidth() - 220) * 0.0033F;
        } else {
            textSize = 1F;
        }
    } else {
        textSize = 1;
    }

    affectedY = baseY;
    if (affectingStat != null) {
        affectedY += affectingStat.getAffectedY() + affectingStat.getHeight();
    }
}
项目:CustomWorldGen    文件:ForgeHooksClient.java   
public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(ScaledResolution res, BossInfoLerping bossInfo, int x, int y, int increment)
{
    RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res),
            BOSSINFO, bossInfo, x, y, increment);
    MinecraftForge.EVENT_BUS.post(evt);
    return evt;
}
项目:Bewitchment    文件:GuiTarots.java   
@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;
}
项目:Bewitchment    文件:BrewHUD.java   
@SubscribeEvent
public void renderOverlay(RenderGameOverlayEvent.Post event) {
    if (!ConfigHandler.BREW_HUD.hide && event.getType() == RenderGameOverlayEvent.ElementType.ALL) {
        Optional<IBrewStorage> optional = BrewStorageHandler.getBrewStorage(Minecraft.getMinecraft().player);
        if (optional.isPresent()) {
            ScaledResolution res = event.getResolution();

            int xOffset = res.getScaledWidth() - ConfigHandler.BREW_HUD.x;
            int yOffset = ConfigHandler.BREW_HUD.y;
            Minecraft mc = Minecraft.getMinecraft();
            Collection<BrewEffect> effects = optional.get().getBrewEffects();
            if (effects.isEmpty()) return;

            for (BrewEffect effect : effects) {
                IBrew brew = effect.getBrew();
                if (brew.shouldRender()) {
                    GlStateManager.pushMatrix();
                    GlStateManager.enableBlend();

                    brew.renderHUD(xOffset, yOffset, mc, effect.getAmplifier());
                    if (ConfigHandler.BREW_HUD.orientation) {
                        yOffset += 22;
                    } else {
                        xOffset += 22;
                    }

                    GlStateManager.disableBlend();
                    GlStateManager.popMatrix();
                }
            }
        }
    }
}
项目:Backmemed    文件:GuiAnimationSettingsOF.java   
/**
 * 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);
        }

        ScaledResolution scaledresolution = new ScaledResolution(this.mc);
        this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
    }
}
项目:MineDonate    文件:GuiItemsScrollArea.java   
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;

}
项目:CustomWorldGen    文件:GuiIngameForge.java   
protected void renderPortal(ScaledResolution res, float partialTicks)
{
    if (pre(PORTAL)) return;

    float f1 = mc.thePlayer.prevTimeInPortal + (mc.thePlayer.timeInPortal - mc.thePlayer.prevTimeInPortal) * partialTicks;

    if (f1 > 0.0F)
    {
        renderPortal(f1, res);
    }

    post(PORTAL);
}
项目:ForgeHax    文件:MinecraftGuiProxy.java   
@Override
public void initGui() {
    inputs.clear();

    ScaledResolution resolution = new ScaledResolution(MC);
    element.init(resolution.getScaledWidth_double(), resolution.getScaledHeight_double());
}
项目:ItemZoom    文件:EventHandler.java   
private static void renderZoomedStack(ItemStack itemStack, GuiContainer guiContainer, Minecraft minecraft) {
    ScaledResolution scaledResolution = new ScaledResolution(minecraft);
    final float scale = Config.getZoomAmount() / 100f * guiContainer.getGuiLeft() / 17f; // item is 16 wide, give it some extra space on each side
    final float xPosition = (guiContainer.getGuiLeft() / scale - 16f) / 2f;
    final float yPosition = (scaledResolution.getScaledHeight() / scale - 16f) / 2f;
    FontRenderer font = getFontRenderer(minecraft, itemStack);

    GlStateManager.pushMatrix();
    GlStateManager.scale(scale, scale, 1);
    GlStateManager.translate(xPosition, yPosition, 0);
    ZoomRenderHelper.enableGUIStandardItemLighting(scale);

    minecraft.getRenderItem().zLevel += 100;
    minecraft.getRenderItem().renderItemAndEffectIntoGUI(minecraft.player, itemStack, 0, 0);
    renderItemOverlayIntoGUI(font, itemStack);
    minecraft.getRenderItem().zLevel -= 100;
    GlStateManager.disableBlend();
    RenderHelper.disableStandardItemLighting();

    GlStateManager.popMatrix();

    if (Config.showHelpText()) {
        String modName = ItemZoom.MOD_NAME;
        int stringWidth = font.getStringWidth(modName);
        int x = (guiContainer.getGuiLeft() - stringWidth) / 2;
        int y = (scaledResolution.getScaledHeight() + Math.round(17 * scale)) / 2;
        font.drawString(modName, x, y, 4210752);

        if (Config.isToggledEnabled()) {
            String toggleText = KeyBindings.TOGGLE.getDisplayName();
            stringWidth = font.getStringWidth(toggleText);
            x = (guiContainer.getGuiLeft() - stringWidth) / 2;
            y += font.FONT_HEIGHT;
            font.drawString(toggleText, x, y, 4210752);
        }
    }
}
项目:DecompiledMinecraft    文件:LoadingScreenRenderer.java   
public LoadingScreenRenderer(Minecraft mcIn)
{
    this.mc = mcIn;
    this.scaledResolution = new ScaledResolution(mcIn);
    this.framebuffer = new Framebuffer(mcIn.displayWidth, mcIn.displayHeight, false);
    this.framebuffer.setFramebufferFilter(9728);
}
项目:Backmemed    文件:ScreenShotHelper.java   
private static void resize(int p_resize_0_, int p_resize_1_)
{
    Minecraft minecraft = Minecraft.getMinecraft();
    minecraft.displayWidth = Math.max(1, p_resize_0_);
    minecraft.displayHeight = Math.max(1, p_resize_1_);

    if (minecraft.currentScreen != null)
    {
        ScaledResolution scaledresolution = new ScaledResolution(minecraft);
        minecraft.currentScreen.onResize(minecraft, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
    }

    updateFramebufferSize();
}
项目:DecompiledMinecraft    文件:EntityRenderer.java   
/**
 * Setup orthogonal projection for rendering GUI screen overlays
 */
public void setupOverlayRendering()
{
    ScaledResolution scaledresolution = new ScaledResolution(this.mc);
    GlStateManager.clear(256);
    GlStateManager.matrixMode(5889);
    GlStateManager.loadIdentity();
    GlStateManager.ortho(0.0D, scaledresolution.getScaledWidth_double(), scaledresolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
    GlStateManager.matrixMode(5888);
    GlStateManager.loadIdentity();
    GlStateManager.translate(0.0F, 0.0F, -2000.0F);
}
项目:ModularMachinery    文件:DynamicMachineRenderContext.java   
public Vec2f getCurrentRenderOffset(float x, float z) {
    Minecraft mc = Minecraft.getMinecraft();
    double sc = new ScaledResolution(mc).getScaleFactor();
    double oX = x + 16D / sc;
    double oZ = z + 16D / sc;
    Vec3d tr = getCurrentMachineTranslate();
    return new Vec2f((float) (oX + tr.x), (float) (oZ + tr.z));
}
项目:TheOink    文件:UltimateChopHUD.java   
@SubscribeEvent
public static void drawUPTime(RenderGameOverlayEvent.Post e){
    Minecraft mc = Minecraft.getMinecraft();
    FontRenderer fontRenderer = mc.fontRenderer;
    ScaledResolution scaled = e.getResolution();
    int xG = 55;
    int yG = 295;
    int xA = 95;

    int FT = 0;
    int flightTime = 2000;
    int thirds = (flightTime / 20) / 3;

    if(e.getType() == RenderGameOverlayEvent.ElementType.EXPERIENCE){
        if(FT > 0) {
            drawText(fontRenderer, "\u00a7cU\u00a7bl\u00a79t\u00a76i\u00a7rm\u00a71a\u00a72t\u00a73e\u00a7r \u00a79P\u00a7ao\u00a7br\u00a7ck\u00a7dc\u00a7eh\u00a7ro\u00a75p" , xG, yG);
            drawText(fontRenderer, "Flight Time:" , xG, 310);
        }

        if(FT >= thirds * 2){
            drawText(fontRenderer, "\u00A72" + FT, xA, yG + 15);
        }else if(FT <= thirds * 2 && FT >= thirds) {
            drawText(fontRenderer, "\u00A76" + FT, xA, yG + 15);
        }else if(FT <= thirds && FT > 20) {
            drawText(fontRenderer, "\u00A74" + FT, xA, yG + 15);
        }else if(FT <= 20 && FT > 0) {
            drawText(fontRenderer, "\u00A7c" + FT, xA, yG + 15);
        }

    }
}
项目:BaseClient    文件:GuiAnimationSettingsOF.java   
/**
 * 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);
        }

        ScaledResolution scaledresolution = new ScaledResolution(this.mc);
        this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
    }
}