net.minecraft.util.FoodStats#net.minecraft.client.gui.ScaledResolution源码实例Demo

下面列出了net.minecraft.util.FoodStats#net.minecraft.client.gui.ScaledResolution 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: OpenPeripheral-Addons   文件: Drawable.java
@SideOnly(Side.CLIENT)
public void draw(ScaledResolution resolution, RenderState renderState, float partialTicks) {
	final float screenX = alignment.getScreenAnchorX(resolution.getScaledWidth()) + boundingBox.left;
	final float screenY = alignment.getScreenAnchorY(resolution.getScaledHeight()) + boundingBox.top;

	final float anchorX = alignment.getObjectAnchorX(boundingBox);
	final float anchorY = alignment.getObjectAnchorY(boundingBox);

	GL11.glPushMatrix();
	if (rotation != 0) {
		GL11.glTranslatef(screenX, screenY, z);
		GL11.glRotated(rotation, 0, 0, 1);
		GL11.glTranslatef(anchorX, anchorY, 0);
	} else {
		GL11.glTranslatef(screenX + anchorX, screenY + anchorY, z);
	}

	drawContents(renderState, partialTicks);
	GL11.glPopMatrix();
}
 
源代码2 项目: ForbiddenMagic   文件: FontHelper.java
private static void set2DMode(FloatBuffer matrixData) {
    Minecraft mc = Minecraft.getMinecraft();
    ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    mc.entityRenderer.setupOverlayRendering();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    //GL11.glLoadMatrix(matrixData);

    GL11.glLoadIdentity();
    GL11.glOrtho(0, mc.displayWidth, 0, mc.displayHeight, -1, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();

    Matrix4f matrix = new Matrix4f();
    matrix.load(matrixData);
    GL11.glTranslatef(matrix.m30*sr.getScaleFactor(),-matrix.m31*sr.getScaleFactor(), 0f);

}
 
源代码3 项目: qcraft-mod   文件: ItemQuantumGoggles.java
@Override
public void renderHelmetOverlay( ItemStack stack, EntityPlayer player, ScaledResolution resolution, float partialTicks, boolean hasScreen, int mouseX, int mouseY )
{
    switch( stack.getItemDamage() )
    {
        case SubTypes.Quantum:
        default:
        {
            QCraft.renderQuantumGogglesOverlay( resolution.getScaledWidth(), resolution.getScaledHeight() );
            break;
        }
        case SubTypes.AntiObservation:
        {
            QCraft.renderAOGogglesOverlay( resolution.getScaledWidth(), resolution.getScaledHeight() );
            break;
        }
    }
}
 
源代码4 项目: Hyperium   文件: HyperiumOverlay.java
public void handleMouseInput() {
    ScaledResolution sr = ResolutionUtil.current();
    int sw = sr.getScaledWidth();
    int sh = sr.getScaledHeight();
    int mx = Mouse.getX() * sw / Minecraft.getMinecraft().displayWidth;
    int my = sh - Mouse.getY() * sh / Minecraft.getMinecraft().displayHeight - 1;

    Integer[] counter = new Integer[]{0};

    components.forEach(c -> c.handleMouseInput(mx, my, sr.getScaledWidth() / 6 * 2,
        sr.getScaledHeight() / 4 + 20 * counter[0]++ + offsetY, sr.getScaledWidth() / 6 * 2, 20));

    int i = Mouse.getEventDWheel();
    if (i > 0 && offsetY != 0) offsetY += 5;
    else if (i < 0) offsetY -= 5;
}
 
源代码5 项目: LiquidBounce   文件: Particle.java
void fall() {
    final Minecraft mc = Minecraft.getMinecraft();
    final ScaledResolution scaledResolution = new ScaledResolution(mc);
    y = (y + ySpeed);
    x = (x + xSpeed);

    if(y > mc.displayHeight)
        y = 1;

    if(x > mc.displayWidth)
        x = 1;

    if(x < 1)
        x = scaledResolution.getScaledWidth();

    if(y < 1)
        y = scaledResolution.getScaledHeight();
}
 
源代码6 项目: LiquidBounce   文件: Scaffold.java
/**
 * Scaffold visuals
 *
 * @param event
 */
@EventTarget
public void onRender2D(final Render2DEvent event) {
    if (counterDisplayValue.get()) {
        GlStateManager.pushMatrix();

        final BlockOverlay blockOverlay = (BlockOverlay) LiquidBounce.moduleManager.getModule(BlockOverlay.class);
        if (blockOverlay.getState() && blockOverlay.getInfoValue().get() && blockOverlay.getCurrentBlock() != null)
            GlStateManager.translate(0, 15F, 0);

        final String info = "Blocks: §7" + getBlocksAmount();
        final ScaledResolution scaledResolution = new ScaledResolution(mc);

        RenderUtils.drawBorderedRect((scaledResolution.getScaledWidth() / 2) - 2,
                (scaledResolution.getScaledHeight() / 2) + 5,
                (scaledResolution.getScaledWidth() / 2) + Fonts.font40.getStringWidth(info) + 2,
                (scaledResolution.getScaledHeight() / 2) + 16, 3, Color.BLACK.getRGB(), Color.BLACK.getRGB());
        GlStateManager.resetColor();
        Fonts.font40.drawString(info, scaledResolution.getScaledWidth() / 2,
                scaledResolution.getScaledHeight() / 2 + 7, Color.WHITE.getRGB());

        GlStateManager.popMatrix();
    }
}
 
源代码7 项目: LiquidBounce   文件: Tower.java
/**
 * Tower visuals
 *
 * @param event
 */
@EventTarget
public void onRender2D(final Render2DEvent event) {
    if(counterDisplayValue.get()) {
        GlStateManager.pushMatrix();

        final BlockOverlay blockOverlay = (BlockOverlay) LiquidBounce.moduleManager.getModule(BlockOverlay.class);
        if (blockOverlay.getState() && blockOverlay.getInfoValue().get() && blockOverlay.getCurrentBlock() != null)
            GlStateManager.translate(0, 15F, 0);

        final String info = "Blocks: §7" + getBlocksAmount();
        final ScaledResolution scaledResolution = new ScaledResolution(mc);

        RenderUtils.drawBorderedRect((scaledResolution.getScaledWidth() / 2) - 2,
                (scaledResolution.getScaledHeight() / 2) + 5,
                (scaledResolution.getScaledWidth() / 2) + Fonts.font40.getStringWidth(info) + 2,
                (scaledResolution.getScaledHeight() / 2) + 16, 3, Color.BLACK.getRGB(), Color.BLACK.getRGB());
        GlStateManager.resetColor();
        Fonts.font40.drawString(info, scaledResolution.getScaledWidth() / 2,
                scaledResolution.getScaledHeight() / 2 + 7, Color.WHITE.getRGB());

        GlStateManager.popMatrix();
    }
}
 
源代码8 项目: LiquidBounce   文件: FramebufferShader.java
/**
 * @author TheSlowly
 */
public void drawFramebuffer(final Framebuffer framebuffer) {
    final ScaledResolution scaledResolution = new ScaledResolution(mc);
    glBindTexture(GL_TEXTURE_2D, framebuffer.framebufferTexture);
    glBegin(GL_QUADS);
    glTexCoord2d(0, 1);
    glVertex2d(0, 0);
    glTexCoord2d(0, 0);
    glVertex2d(0, scaledResolution.getScaledHeight());
    glTexCoord2d(1, 0);
    glVertex2d(scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight());
    glTexCoord2d(1, 1);
    glVertex2d(scaledResolution.getScaledWidth(), 0);
    glEnd();
    glUseProgram(0);
}
 
源代码9 项目: Cyberware   文件: HudElementBase.java
@Override
public void render(EntityPlayer player, ScaledResolution resolution, boolean hudjackAvailable, boolean isConfigOpen, float partialTicks)
{
	int x = getX();
	int y = getY();
	if (getHorizontalAnchor() == EnumAnchorHorizontal.RIGHT)
	{
		x = resolution.getScaledWidth() - x - getWidth();
	}
	if (getVerticalAnchor() == EnumAnchorVertical.BOTTOM)
	{
		y = resolution.getScaledHeight() - y - getHeight();
	}
	
	renderElement(x, y, player, resolution, hudjackAvailable, isConfigOpen, partialTicks);
}
 
源代码10 项目: LiquidBounce   文件: MixinGuiConnecting.java
/**
 * @author CCBlueX
 */
@Overwrite
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());

    this.drawDefaultBackground();

    RenderUtils.drawLoadingCircle(scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 70);

    String ip = "Unknown";

    final ServerData serverData = mc.getCurrentServerData();
    if(serverData != null)
        ip = serverData.serverIP;

    Fonts.font40.drawCenteredString("Connecting to", scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 110, 0xFFFFFF, true);
    Fonts.font35.drawCenteredString(ip, scaledResolution.getScaledWidth() / 2, scaledResolution.getScaledHeight() / 4 + 120, 0x5281FB, true);

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
源代码11 项目: ehacks-pro   文件: Events.java
@SubscribeEvent
public void onGameOverlay(RenderGameOverlayEvent.Text event) {
    if (!cheatEnabled) {
        return;
    }
    GLUtils.hasClearedDepth = false;
    ModuleController.INSTANCE.modules.stream().filter((mod) -> !(!mod.isActive() || Wrapper.INSTANCE.world() == null)).forEachOrdered((mod) -> {
        mod.onGameOverlay(event);
    });
    if (Wrapper.INSTANCE.mc().currentScreen == null) {
        int x2 = 8;
        int y2 = 7;
        GL11.glPushMatrix();
        GL11.glScalef(1f, 1f, 1f);
        String Copyright1 = "EHacks Pro v" + Main.version;
        String Copyright2 = "by radioegor146";
        ScaledResolution get = new ScaledResolution(Wrapper.INSTANCE.mc(), Wrapper.INSTANCE.mc().displayWidth, Wrapper.INSTANCE.mc().displayHeight);
        this.fontRender.drawString(Copyright1, 2, 2, Events.rainbowEffect_Text(9999999L, 1.0f).getRGB());
        this.fontRender.drawStringWithShadow(Copyright2, get.getScaledWidth() - 2 - this.fontRender.getStringWidth(Copyright2), get.getScaledHeight() - this.fontRender.FONT_HEIGHT - 2, GLUtils.getColor(255, 255, 255));
        GL11.glPopMatrix();
    }
    EHacksGui.clickGui.drawBack();
}
 
源代码12 项目: Hyperium   文件: VanillaEnhancementsHud.java
@InvokeEvent
public void renderEnchantments(RenderHUDEvent e) {
    if (Settings.ENCHANTMENTS_ABOVE_HOTBAR) {
        ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem();
        if (heldItemStack != null) {
            String toDraw = heldItemStack.getItem() instanceof ItemPotion ? getPotionEffectString(heldItemStack) : getEnchantmentString(heldItemStack);
            GL11.glPushMatrix();
            GL11.glScalef(0.5f, 0.5f, 0.5f);
            ScaledResolution res = ResolutionUtil.current();
            int y = res.getScaledHeight() - 59;
            y += (mc.playerController.shouldDrawHUD() ? -2 : 14);
            y = y + mc.fontRendererObj.FONT_HEIGHT;
            y <<= 1;
            int x = res.getScaledWidth() - (mc.fontRendererObj.getStringWidth(toDraw) >> 1);
            mc.fontRendererObj.drawString(toDraw, x, y, 13421772);
            GL11.glScalef(2.0f, 2.0f, 2.0f);
            GL11.glPopMatrix();
        }
    }
}
 
源代码13 项目: Hyperium   文件: PlayerStatsGui.java
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
    super.mouseClicked(mouseX, mouseY, mouseButton);
    boolean flag = false;
    for (GuiButton guiButton : buttonList) {
        if (guiButton.isMouseOver()) flag = true;
    }

    boolean flag2 = focused == null;
    if (!flag && flag2) focused = null;

    ScaledResolution current = ResolutionUtil.current();
    if (focused != null && new GuiBlock((current.getScaledWidth() / 2 - 22 - 64), (current.getScaledWidth() / 2 - 22), 73, 73 + 64).isMouseOver(mouseX, mouseY)) {
        focused = null;
        offset = 0;
    }

    if (flag2 && mouseButton == 0) {
        location.keySet().stream().filter(abstractHypixelStats -> location.get(abstractHypixelStats).isMouseOver(mouseX, mouseY))
            .forEach(abstractHypixelStats -> {
                focused = abstractHypixelStats;
                hovered = null;
                offset = 0;
            });
    }
}
 
源代码14 项目: PneumaticCraft   文件: EntityTrackUpgradeHandler.java
@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;

}
 
源代码15 项目: SkyblockAddons   文件: IslandWarpGui.java
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
    if (mouseButton == 0 && selectedMarker != null) {
        Minecraft.getMinecraft().displayGuiScreen(null);

        if (SkyblockAddons.getInstance().getConfigValues().isEnabled(Feature.DOUBLE_WARP)) {
            doubleWarpMarker = selectedMarker;

            // Remove the marker if it didn't trigger for some reason...
            SkyblockAddons.getInstance().getNewScheduler().scheduleDelayedTask(new SkyblockRunnable() {
                @Override
                public void run() {
                    if (doubleWarpMarker != null) {
                        doubleWarpMarker = null;
                    }
                }
            }, 20);
        }
        Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp "+selectedMarker.getWarpName());
    }

    int minecraftScale = new ScaledResolution(mc).getScaleFactor();
    float islandGuiScale = ISLAND_SCALE;

    mouseX *= minecraftScale;
    mouseY *= minecraftScale;

    mouseX /= islandGuiScale;
    mouseY /= islandGuiScale;

    mouseX -= IslandWarpGui.SHIFT_LEFT;
    mouseY -= IslandWarpGui.SHIFT_TOP;

    super.mouseClicked(mouseX, mouseY, mouseButton);
}
 
源代码16 项目: OpenPeripheral-Addons   文件: GuiCapture.java
@Override
public void handleMouseInput() {
	super.handleMouseInput();

	final int button = Mouse.getEventButton();
	final int wheel = Mouse.getEventDWheel();
	final int mx = Mouse.getEventX();
	final int my = Mouse.getEventY();

	final float scaleX = (float)this.width / this.mc.displayWidth;
	final float scaleY = (float)this.height / this.mc.displayHeight;

	final float x = mx * scaleX;
	final float y = this.height - my * scaleY;

	if (button != -1 || wheel != 0) {
		final ScaledResolution resolution = new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
		final DrawableHitInfo hit = TerminalManagerClient.instance.findDrawableHit(guid, resolution, x, y);

		if (button != -1) {
			final boolean state = Mouse.getEventButtonState();
			createMouseButtonEvent(button, state, hit).sendToServer();
			final boolean draggingStarted = updateButtonCounter(state);
			if (draggingStarted) resetDraggingLimiter(x, y);
		}

		if (wheel != 0) createMouseWheelEvent(wheel, hit).sendToServer();
	}

	{
		final float dx = (x - lastDragX);
		final float dy = (y - lastDragY);

		if (canSendDragEvent(dx, dy)) {
			createDragEvent(dx, dy).sendToServer();
			resetDraggingLimiter(x, y);
		}
	}

}
 
源代码17 项目: SkyblockAddons   文件: SkyblockAddonsGui.java
/**
 * Draws the default text at the top at bottoms of the GUI.
 * @param gui The gui to draw the text on.
 */
static void drawDefaultTitleText(GuiScreen gui, int alpha) {
    int defaultBlue = SkyblockAddons.getInstance().getUtils().getDefaultBlue(alpha);

    int height = 90;
    int width = height*2;
    ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());

    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();

    SkyblockAddons.getInstance().getUtils().enableStandardGLOptions();
    textureManager.bindTexture(LOGO);
    SkyblockAddons.getInstance().getUtils().drawModalRectWithCustomSizedTexture(scaledResolution.getScaledWidth()/2F-width/2F, 3, 0, 0, width, height, width, height, true);

    int animationMillis = 4000;
    float glowAlpha;
    glowAlpha = System.currentTimeMillis()%animationMillis;
    if (glowAlpha > animationMillis/2F) {
        glowAlpha = (animationMillis-glowAlpha)/(animationMillis/2F);
    } else {
        glowAlpha = glowAlpha/(animationMillis/2F);
    }

    GlStateManager.color(1,1,1, glowAlpha);
    textureManager.bindTexture(LOGO_GLOW);
    SkyblockAddons.getInstance().getUtils().drawModalRectWithCustomSizedTexture(scaledResolution.getScaledWidth()/2F-width/2F, 3, 0, 0, width, height, width, height, true);

    GlStateManager.color(1,1,1, 1);
    String version = "v" + SkyblockAddons.VERSION.replace("beta", "b") + " by Biscut";
    drawScaledString(gui, version, 55, defaultBlue, 1.3, 170 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(version), false);

    if (gui instanceof SkyblockAddonsGui) {
        drawScaledString(gui, "Special Credits: InventiveTalent - Magma Boss Timer API", gui.height - 22, defaultBlue, 1, 0);
    }
    SkyblockAddons.getInstance().getUtils().restoreGLOptions();
}
 
源代码18 项目: SkyblockAddons   文件: ButtonResize.java
@Override
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
    ScaledResolution sr = new ScaledResolution(mc);
    float minecraftScale = sr.getScaleFactor();
    float floatMouseX = Mouse.getX() / minecraftScale;
    float floatMouseY = (mc.displayHeight - Mouse.getY()) / minecraftScale;

    cornerOffsetX = floatMouseX;
    cornerOffsetY = floatMouseY;

    return hovered;
}
 
源代码19 项目: SkyblockAddons   文件: RenderListener.java
/**
 * Renders the messages from the SkyblockAddons Updater
 */
private void drawUpdateMessage() {
    Updater updater = main.getUpdater();
    String message = updater.getMessageToRender();

    if (updater.hasUpdate() && message != null && !updateMessageDisplayed) {
        Minecraft mc = Minecraft.getMinecraft();
        String[] textList = main.getUtils().wrapSplitText(message, 36);

        int halfWidth = new ScaledResolution(mc).getScaledWidth() / 2;
        Gui.drawRect(halfWidth - 110, 20, halfWidth + 110, 53 + textList.length * 10, main.getUtils().getDefaultBlue(140));
        String title = SkyblockAddons.MOD_NAME;
        GlStateManager.pushMatrix();
        float scale = 1.5F;
        GlStateManager.scale(scale, scale, 1);
        MinecraftReflection.FontRenderer.drawString(title, (int) (halfWidth / scale) - MinecraftReflection.FontRenderer.getStringWidth(title) / 2, (int) (30 / scale), ChatFormatting.WHITE);
        GlStateManager.popMatrix();
        int y = 45;
        for (String line : textList) {
            MinecraftReflection.FontRenderer.drawString(line, halfWidth - MinecraftReflection.FontRenderer.getStringWidth(line) / 2, y, ChatFormatting.WHITE);
            y += 10;
        }

        main.getScheduler().schedule(Scheduler.CommandType.ERASE_UPDATE_MESSAGE, 10);

        main.getUpdater().sendUpdateMessage();
    }
}
 
源代码20 项目: seppuku   文件: RenderUtil.java
public static void updateModelViewProjectionMatrix() {
    glGetFloat(GL_MODELVIEW_MATRIX, MODELVIEW);
    glGetFloat(GL_PROJECTION_MATRIX, PROJECTION);
    glGetInteger(GL_VIEWPORT, VIEWPORT);
    final ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
    GLUProjection.getInstance().updateMatrices(VIEWPORT, MODELVIEW, PROJECTION, (float) res.getScaledWidth() / (float) Minecraft.getMinecraft().displayWidth, (float) res.getScaledHeight() / (float) Minecraft.getMinecraft().displayHeight);
}
 
源代码21 项目: PneumaticCraft   文件: MainHelmetHandler.java
@Override
@SideOnly(Side.CLIENT)
public IGuiAnimatedStat getAnimatedStat(){
    if(powerStat == null) {
        Minecraft minecraft = Minecraft.getMinecraft();
        ScaledResolution sr = new ScaledResolution(minecraft, minecraft.displayWidth, minecraft.displayHeight);
        powerStat = new GuiAnimatedStat(null, "Helmet Pressure: ", "", powerStatX != -1 ? powerStatX : sr.getScaledWidth() - 2, powerStatY, 0x3000AA00, null, powerStatLeftSided);
        powerStat.setMinDimensionsAndReset(0, 0);
        powerStat.openWindow();
    }
    return powerStat;
}
 
源代码22 项目: seppuku   文件: GuiHudEditor.java
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    super.drawScreen(mouseX, mouseY, partialTicks);
    this.drawDefaultBackground();

    final ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());

    final float halfWidth = res.getScaledWidth() / 2.0f;
    final float halfHeight = res.getScaledHeight() / 2.0f;
    RenderUtil.drawLine(halfWidth, 0, halfWidth, res.getScaledHeight(), 1, 0x75909090);
    RenderUtil.drawLine(0, halfHeight, res.getScaledWidth(), halfHeight, 1, 0x75909090);

    for (AnchorPoint point : Seppuku.INSTANCE.getHudManager().getAnchorPoints()) {
        RenderUtil.drawRect(point.getX() - 1, point.getY() - 1, point.getX() + 1, point.getY() + 1, 0x75909090);
    }

    for (HudComponent component : Seppuku.INSTANCE.getHudManager().getComponentList()) {
        if (component.isVisible()) {
            component.render(mouseX, mouseY, partialTicks);

            if (component instanceof DraggableHudComponent) {
                DraggableHudComponent draggable = (DraggableHudComponent) component;
                if (draggable.isDragging()) {
                    RenderUtil.drawRect(draggable.getX(), draggable.getY(), draggable.getX() + draggable.getW(), draggable.getY() + draggable.getH(), 0x35FFFFFF);
                    for (HudComponent other : Seppuku.INSTANCE.getHudManager().getComponentList()) {
                        if (other != draggable && draggable.collidesWith(other) && other.isVisible() && draggable.isSnappable()) {
                            RenderUtil.drawRect(draggable.getX(), draggable.getY(), draggable.getX() + draggable.getW(), draggable.getY() + draggable.getH(), 0x3510FF10);
                            RenderUtil.drawRect(other.getX(), other.getY(), other.getX() + other.getW(), other.getY() + other.getH(), 0x35FF1010);
                        }
                    }
                }
            }
        }
    }
}
 
源代码23 项目: Cyberware   文件: GuiHudConfiguration.java
public static int getAbsoluteX(ScaledResolution sr, IHudElement element)
{
	if (element.getHorizontalAnchor() == EnumAnchorHorizontal.RIGHT)
	{
		return sr.getScaledWidth() - element.getX() - element.getWidth();
	}
	return element.getX();
}
 
源代码24 项目: LiquidBounce   文件: BackgroundShader.java
@Override
public void updateUniforms() {
    final ScaledResolution scaledResolution = new ScaledResolution(mc);

    final int resolutionID = getUniform("iResolution");
    if(resolutionID > -1)
        GL20.glUniform2f(resolutionID, (float) scaledResolution.getScaledWidth() * 2, (float) scaledResolution.getScaledHeight() * 2);
    final int timeID = getUniform("iTime");
    if(timeID > -1) GL20.glUniform1f(timeID, time);

    time += 0.005F * RenderUtils.deltaTime;
}
 
源代码25 项目: LiquidBounce   文件: MixinMinecraft.java
@Inject(method = "displayGuiScreen", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;currentScreen:Lnet/minecraft/client/gui/GuiScreen;", shift = At.Shift.AFTER))
private void displayGuiScreen(CallbackInfo callbackInfo) {
    if(currentScreen instanceof net.minecraft.client.gui.GuiMainMenu || (currentScreen != null && currentScreen.getClass().getName().startsWith("net.labymod") && currentScreen.getClass().getSimpleName().equals("ModGuiMainMenu"))) {
        currentScreen = new GuiMainMenu();

        ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
        currentScreen.setWorldAndResolution(Minecraft.getMinecraft(), scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight());
        skipRenderWorld = false;
    }

    LiquidBounce.eventManager.callEvent(new ScreenEvent(currentScreen));
}
 
源代码26 项目: PneumaticCraft   文件: ClientEventHandler.java
@SubscribeEvent
public void tickEnd(TickEvent.RenderTickEvent event){
    if(event.phase == TickEvent.Phase.END && FMLClientHandler.instance().getClient().inGameHasFocus && PneumaticCraft.proxy.getPlayer().worldObj != null && (ModuleRegulatorTube.inverted || !ModuleRegulatorTube.inLine)) {
        Minecraft mc = FMLClientHandler.instance().getClient();
        ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
        FontRenderer fontRenderer = FMLClientHandler.instance().getClient().fontRenderer;
        String warning = EnumChatFormatting.RED + I18n.format("gui.regulatorTube.hudMessage." + (ModuleRegulatorTube.inverted ? "inverted" : "notInLine"));
        fontRenderer.drawStringWithShadow(warning, sr.getScaledWidth() / 2 - fontRenderer.getStringWidth(warning) / 2, sr.getScaledHeight() / 2 + 30, 0xFFFFFFFF);
    }
}
 
源代码27 项目: LiquidBounce   文件: MixinGuiInGame.java
@Inject(method = "renderTooltip", at = @At("RETURN"))
private void renderTooltipPost(ScaledResolution sr, float partialTicks, CallbackInfo callbackInfo) {
    if (!ClassUtils.hasClass("net.labymod.api.LabyModAPI")) {
        LiquidBounce.eventManager.callEvent(new Render2DEvent(partialTicks));
        AWTFontRenderer.Companion.garbageCollectionTick();
    }
}
 
源代码28 项目: Hyperium   文件: HyperiumGuiIngame.java
public void renderGameOverlay(float part) {
    Minecraft.getMinecraft().mcProfiler.startSection("hyperium_overlay");
    EventBus.INSTANCE.post(new RenderHUDEvent(new ScaledResolution(Minecraft.getMinecraft()), part));
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    Minecraft.getMinecraft().mcProfiler.endSection();

}
 
源代码29 项目: Hyperium   文件: HyperiumGuiIngame.java
public void renderScoreboard(ScoreObjective objective, ScaledResolution resolution) {
    //For *extra* scoreboards
    ScoreboardDisplay.objective = objective;
    ScoreboardDisplay.resolution = resolution;

    if (renderScoreboard) Hyperium.INSTANCE.getHandlers().getScoreboardRenderer().render(objective, resolution);
}
 
源代码30 项目: Hyperium   文件: HyperiumFontRenderer.java
public HyperiumFontRenderer(String fontName, float fontSize) {
    name = fontName;
    size = fontSize;
    ScaledResolution resolution = new ScaledResolution(Minecraft.getMinecraft());

    try {
        prevScaleFactor = resolution.getScaleFactor();
        unicodeFont = new UnicodeFont(getFontByName(fontName).deriveFont(fontSize * prevScaleFactor / 2));
        unicodeFont.addAsciiGlyphs();
        unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE));
        unicodeFont.loadGlyphs();
    } catch (FontFormatException | IOException | SlickException e) {
        e.printStackTrace();
    }

    this.antiAliasingFactor = resolution.getScaleFactor();
}