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


Java Gui类代码示例

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


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

示例1: keyTyped

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
 
	boolean textFocused = false;
	
	for (Gui control : this.controls) {
		if (control instanceof GuiTextField) {
			GuiTextField textField = (GuiTextField) control;
			if (textField.isFocused()) {
				textFocused = true;
				textField.textboxKeyTyped(typedChar, keyCode);
				break;
			}
		}
	}

	if (!textFocused || keyCode != Keyboard.KEY_E)
		super.keyTyped(typedChar, keyCode);
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:20,代码来源:GuiContainerBase.java

示例2: drawGuiContainerForegroundLayer

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    //String s = this.entity.getDisplayName().getUnformattedText();
    //this.fontRendererObj.drawString(s, 88 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);            //#404040
    //this.fontRendererObj.drawString(this.playerInv.getDisplayName().getUnformattedText(), 8, 72, 4210752);      //#404040

	int rfBarX = 191;
	int rfBarY = 17;
    int rfBarHeight = 88;
    int rfBarWidth = 14;
    
    int usedHeight = (int)(this.entity.getEnergyStored(EnumFacing.DOWN) / (double)this.entity.getMaxEnergyStored(EnumFacing.DOWN) * rfBarHeight);
    Gui.drawRect(rfBarX, rfBarY, rfBarX + rfBarWidth, rfBarY + rfBarHeight, 0xFF000000);
    Gui.drawRect(rfBarX, rfBarY + rfBarHeight - usedHeight, rfBarX + rfBarWidth, rfBarY + rfBarHeight, 0xFFFF0000);

    super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:18,代码来源:BundleBuilderGuiContainer.java

示例3: drawGuiContainerForegroundLayer

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {

    GlStateManager.pushMatrix();
   		GlStateManager.translate(-guiLeft, -guiTop, 0);
		for (Gui control : this.controls) {
			if (control instanceof GuiTextField) {
				((GuiTextField)control).drawTextBox();
			} else if (control instanceof GuiButton) {
				((GuiButton)control).drawButton(this.mc, mouseX, mouseY);
			}
		}
   	GlStateManager.popMatrix();		
	
	super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:17,代码来源:GuiContainerBase.java

示例4: drawButton

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@Override
public void drawButton(Minecraft mc, int x, int y, float partialTicks) {
    if (thisVisible) super.drawButton(mc, x, y, partialTicks);

    if (visible) {
        if (renderedStacks != null) {
            int middleX = this.x + width / 2;
            int startX = middleX - renderedStacks.length * 9 + 1;
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
            RenderHelper.enableGUIStandardItemLighting();
            for (int i = 0; i < renderedStacks.length; i++) {
                itemRenderer.renderItemAndEffectIntoGUI(renderedStacks[i], startX + i * 18, this.y + 2);
            }
            RenderHelper.disableStandardItemLighting();
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
        if (resLoc != null) {
            mc.getTextureManager().bindTexture(resLoc);
            drawModalRectWithCustomSizedTexture(this.x + width / 2 - 8, this.y + 2, 0, 0, 16, 16, 16, 16);
        }
        if (enabled && !thisVisible && x >= this.x && y >= this.y && x < this.x + width && y < this.y + height) {
            Gui.drawRect(this.x, this.y, this.x + width, this.y + height, invisibleHoverColor);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:26,代码来源:GuiButtonSpecial.java

示例5: render

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@Override
public void render(int mouseX, int mouseY, float partialTick) {
    GL11.glColor4d(1, 1, 1, 1);
    if (!Mouse.isButtonDown(0)) dragging = false;
    if (!wasClicking && Mouse.isButtonDown(0) && getBounds().contains(mouseX, mouseY)) {
        dragging = true;
    }
    if (!enabled) dragging = false;
    wasClicking = Mouse.isButtonDown(0);
    if (dragging) currentScroll = (float) (mouseY - 7 - getBounds().y) / (getBounds().height - 17);
    currentScroll = MathHelper.clamp(currentScroll, 0, 1);
    Minecraft.getMinecraft().getTextureManager().bindTexture(scrollTexture);
    Gui.drawModalRectWithCustomSizedTexture(x, y, 12, 0, getBounds().width, 1, 26, 15);
    for (int i = 0; i < getBounds().height - 2; i++)
        Gui.drawModalRectWithCustomSizedTexture(x, y + 1 + i, 12, 1, getBounds().width, 1, 26, 15);
    Gui.drawModalRectWithCustomSizedTexture(x, y + getBounds().height - 1, 12, 14, getBounds().width, 1, 26, 15);

    if (!enabled) GL11.glColor4d(0.6, 0.6, 0.6, 1);
    Gui.drawModalRectWithCustomSizedTexture(x + 1, y + 1 + (int) ((getBounds().height - 17) * currentScroll), 0, 0, 12, 15, 26, 15);
    GL11.glColor4d(1, 1, 1, 1);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:WidgetVerticalScrollbar.java

示例6: render

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@Override
public void render(int mouseX, int mouseY, float partialTick) {
    if (renderBackground) {
        Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.WIDGET_AMADRON_OFFER);
        GlStateManager.color(1f, canBuy ? 1f : 0.4f, canBuy ? 1f : 0.4f, 1f);
        Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 0, getBounds().width, getBounds().height, 256, 256);
    }
    for (IGuiWidget widget : widgets) {
        widget.render(mouseX, mouseY, partialTick);
    }
    Minecraft.getMinecraft().fontRenderer.drawString(offer.getVendor(), x + 2, y + 2, 0xFF000000);
    boolean customOffer = offer instanceof AmadronOfferCustom;
    if (shoppingAmount > 0) {
        Minecraft.getMinecraft().fontRenderer.drawString(TextFormatting.BLACK.toString() + shoppingAmount, x + 36 - Minecraft.getMinecraft().fontRenderer.getStringWidth("" + shoppingAmount) / 2, y + (customOffer ? 15 : 20), 0xFF000000);
    }
    if (customOffer) {
        AmadronOfferCustom custom = (AmadronOfferCustom) offer;
        Minecraft.getMinecraft().fontRenderer.drawString(TextFormatting.DARK_BLUE.toString() + custom.getStock(), x + 36 - Minecraft.getMinecraft().fontRenderer.getStringWidth("" + custom.getStock()) / 2, y + 25, 0xFF000000);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:21,代码来源:WidgetAmadronOffer.java

示例7: renderExtraInfo

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@Override
public void renderExtraInfo() {
    if (getExtraStringInfo() != null) {
        GL11.glPushMatrix();
        GL11.glScaled(0.5, 0.5, 0.5);
        FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
        String[] splittedInfo = WordUtils.wrap(getExtraStringInfo(), 40).split(System.getProperty("line.separator"));
        for (int i = 0; i < splittedInfo.length; i++) {
            int stringLength = fr.getStringWidth(splittedInfo[i]);
            int startX = getWidth() / 2 - stringLength / 4;
            int startY = getHeight() / 2 - (fr.FONT_HEIGHT + 1) * (splittedInfo.length - 1) / 4 + (fr.FONT_HEIGHT + 1) * i / 2 - fr.FONT_HEIGHT / 4;
            Gui.drawRect(startX * 2 - 1, startY * 2 - 1, startX * 2 + stringLength + 1, startY * 2 + fr.FONT_HEIGHT + 1, 0xFFFFFFFF);
            fr.drawString(splittedInfo[i], startX * 2, startY * 2, 0xFF000000);
        }
        GL11.glPopMatrix();
        GL11.glColor4d(1, 1, 1, 1);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:ProgWidget.java

示例8: ourDrawEntry

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
public void ourDrawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isHovering)
{
    Util.getWrapper().draw(wrapped, slotIndex, x, y, listWidth, slotHeight, mouseX > (listWidth / 2) ? mouseX : Integer.MAX_VALUE, mouseY, false);

    Server server = getServerData().server;
    EnumFlag flag = server.flag;
    if (flag == null)
        return;

    Minecraft.getMinecraft().getTextureManager().bindTexture(flags);
    int flagWidth = 16;
    int flagHeight = flag.height / (flag.width / flagWidth);
    Gui.drawScaledCustomSizeModalRect(x + listWidth - 5 - flagWidth, y + slotHeight - flagHeight, flag.x, flag.y, flag.width, flag.height, flagWidth, flagHeight, 512, 512);
    if (mouseX >= x + listWidth - 5 - flagWidth
        && mouseX <= x + listWidth - 5
        && mouseY >= y + slotHeight - flagHeight
        && mouseY <= y + slotHeight - flagHeight + flagHeight)
    {
        String countryName = Callbacks.getCountries().get(flag.name());
        if (countryName == null)
        {
            countryName = flag.name();
        }
        owner.setHoveringText(countryName + (server.subdivision.equals("Unknown") ? "" : "\n" + server.subdivision));
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:27,代码来源:ServerListEntryPublic.java

示例9: renderIcon

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
public void renderIcon(float p_178663_1_, int alpha)
{
    int i = -1;
    String s = FontRenderer.getFormatFromString(this.team.getColorPrefix());

    if (s.length() >= 2)
    {
        i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1));
    }

    if (i >= 0)
    {
        float f = (float)(i >> 16 & 255) / 255.0F;
        float f1 = (float)(i >> 8 & 255) / 255.0F;
        float f2 = (float)(i & 255) / 255.0F;
        Gui.drawRect(1, 1, 15, 15, MathHelper.rgb(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24);
    }

    Minecraft.getMinecraft().getTextureManager().bindTexture(this.location);
    GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float)alpha / 255.0F);
    Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
    Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:TeleportToTeam.java

示例10: onRenderGUI

import net.minecraft.client.gui.Gui; //导入依赖的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: render

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
public void render()
{
	String version = getVersionString();
	
	// draw version background
	GL11.glEnable(GL11.GL_BLEND);
	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], 0.5F);
	}else
		GL11.glColor4f(1, 1, 1, 0.5F);
	drawQuads(0, 6, Fonts.segoe22.getStringWidth(version) + 76, 18);
	
	// draw version string
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	Fonts.segoe22.drawString(version, 74, 4, 0xFF000000);
	
	// draw Wurst logo
	GL11.glColor4f(1, 1, 1, 1);
	Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
	Gui.drawModalRectWithCustomSizedTexture(0, 3, 0, 0, 72, 18, 72, 18);
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:27,代码来源:WurstLogo.java

示例12: func_178663_a

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
public void func_178663_a(float p_178663_1_, int alpha)
{
    int i = -1;
    String s = FontRenderer.getFormatFromString(this.field_178676_b.getColorPrefix());

    if (s.length() >= 2)
    {
        i = Minecraft.getMinecraft().fontRendererObj.getColorCode(s.charAt(1));
    }

    if (i >= 0)
    {
        float f = (float)(i >> 16 & 255) / 255.0F;
        float f1 = (float)(i >> 8 & 255) / 255.0F;
        float f2 = (float)(i & 255) / 255.0F;
        Gui.drawRect(1, 1, 15, 15, MathHelper.func_180183_b(f * p_178663_1_, f1 * p_178663_1_, f2 * p_178663_1_) | alpha << 24);
    }

    Minecraft.getMinecraft().getTextureManager().bindTexture(this.field_178677_c);
    GlStateManager.color(p_178663_1_, p_178663_1_, p_178663_1_, (float)alpha / 255.0F);
    Gui.drawScaledCustomSizeModalRect(2, 2, 8.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
    Gui.drawScaledCustomSizeModalRect(2, 2, 40.0F, 8.0F, 8, 8, 12, 12, 64.0F, 64.0F);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:TeleportToTeam.java

示例13: renderLine

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
private static void renderLine(int regen, boolean low, int yTexture, int maxHealth, int maxExtraHearts, int current, int absorption, Gui gui, boolean highlight) {
    GlStateManager.pushMatrix();
    Int2IntMap map = new Int2IntArrayMap();
    if (low) {
        for (int i = 0; i < (maxHealth + maxExtraHearts); i++)
            map.put(i, EventHandler.rand.nextInt(2));
    }

    renderMax(regen, map, maxHealth, yTexture, gui, highlight);
    if (maxExtraHearts > 0) { //for absorption
        if (maxHealth != 0) {
            GlStateManager.translate(2 + 9 * maxHealth, 0, 0);
        }
        renderMax(regen - maxHealth, map, maxExtraHearts, yTexture, gui, false); //Do not highlight absorption
    }
    GlStateManager.popMatrix();
    GlStateManager.translate(0, 0, 1);

    renderCurrentHealth(regen, map, current, yTexture, gui);

    if (absorption > 0) {
        int offset = maxHealth * 9 + (maxHealth == 0 ? 0 : 2);
        GlStateManager.translate(offset, 0, 0);
        renderAbsorption(regen - maxHealth, map, absorption, yTexture, gui);
    }
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:27,代码来源:GuiUtils.java

示例14: renderLithiumControl

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void renderLithiumControl(LImage control, GuiScreen gui) {
    Point loc = NewLithiumGUI.centerControl(control);

    //Ask ImageManager to give us a dynamic texture
    DynamicTexture imageTexture = ImageManager.getDynamicTexture(control);
    if (imageTexture != null) {
        //Get Minecraft's texture manager
        TextureManager textureManager = ModCoderPackUtils.getTextureManager();

        //Bind the texture. (In other words, tell Minecraft to use this texture)
        textureManager.bindTexture(textureManager.getDynamicTextureLocation(control.getUUID().toString(), imageTexture));
        //Correct colors
        GlStateManager.color(1, 1, 1, 1);
        //Draw the image to the screen
        Gui.drawModalRectWithCustomSizedTexture(loc.getX(), loc.getY(), 0.0F, 0.0F, control.getSize().getWidth(), control.getSize().getHeight(), control.getSize().getWidth(), control.getSize().getHeight());
    }
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:20,代码来源:ImageRenderer.java

示例15: renderLithiumControl

import net.minecraft.client.gui.Gui; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public void renderLithiumControl(LProgressBar control, GuiScreen gui) {
	Point loc = NewLithiumGUI.centerControl(control);

	int left = loc.getX();
	int top = loc.getY();
	int right = left + control.getSize().getWidth();
	int bottom = top + control.getSize().getHeight();

	//Render outside of the progressbar
	Gui.drawRect(left, top, right, bottom, (int) control.getBorderColor().getHexColor());
	//Draw the inside of the progressbar
	Gui.drawRect(left + 1, top + 1, right - 1, bottom - 1, (int) control.getInsideColor().getHexColor());

	int startX = left + 2;
	int endX = right - 2;

	//Calculate the size of the progress and fill it
	Gui.drawRect(startX, top + 2, MiscUtils.ConvertRange(control.getMinValue(), control.getMaxValue(), startX, endX, control.getProgress()), bottom - 2, (int) control.getProgressColor().getHexColor());
}
 
开发者ID:NickAcPT,项目名称:Lithium-Forge,代码行数:22,代码来源:ProgressBarRenderer.java


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