当前位置: 首页>>代码示例>>Java>>正文


Java ScaledResolution类代码示例

本文整理汇总了Java中net.minecraft.client.gui.ScaledResolution的典型用法代码示例。如果您正苦于以下问题:Java ScaledResolution类的具体用法?Java ScaledResolution怎么用?Java ScaledResolution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScaledResolution类属于net.minecraft.client.gui包,在下文中一共展示了ScaledResolution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRenderOverlayText

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
@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();
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:18,代码来源:GuiMana.java

示例2: onMouseEvent

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:27,代码来源:RemoteShellOverlay.java

示例3: drawScreen

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
@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);
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:23,代码来源:NewLithiumGUI.java

示例4: loadData

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
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());
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:19,代码来源:GuiTarots.java

示例5: 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);
	}

}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:25,代码来源:GuiTarots.java

示例6: render

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
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();
}
 
开发者ID:boomboompower,项目名称:TextDisplayer,代码行数:27,代码来源:Message.java

示例7: drawGui

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
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);
	}

}
 
开发者ID:Lemonszz,项目名称:Anima-Mundi,代码行数:18,代码来源:GuiAnalyser.java

示例8: renderHelmet

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:GuiIngameForge.java

示例9: 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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:GuiAchievement.java

示例10: onRenderGUI

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
@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);
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:26,代码来源:TacoCmd.java

示例11: 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 != GameSettings.Options.AA_LEVEL.ordinal())
        {
            ScaledResolution scaledresolution = new ScaledResolution(this.mc);
            this.setWorldAndResolution(this.mc, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:27,代码来源:GuiQualitySettingsOF.java

示例12: drawScreen

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
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);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:GuiGrabber.java

示例13: handleLoadingScreen

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:FMLClientHandler.java

示例14: 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 != 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);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:29,代码来源:GuiQualitySettingsOF.java

示例15: onRenderOverlay

import net.minecraft.client.gui.ScaledResolution; //导入依赖的package包/类
@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);
					//}
				}
			}
		}
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:34,代码来源:GuiMana.java


注:本文中的net.minecraft.client.gui.ScaledResolution类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。