當前位置: 首頁>>代碼示例>>Java>>正文


Java TextFormatting.GREEN屬性代碼示例

本文整理匯總了Java中net.minecraft.util.text.TextFormatting.GREEN屬性的典型用法代碼示例。如果您正苦於以下問題:Java TextFormatting.GREEN屬性的具體用法?Java TextFormatting.GREEN怎麽用?Java TextFormatting.GREEN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.util.text.TextFormatting的用法示例。


在下文中一共展示了TextFormatting.GREEN屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: drawGuiContainerForegroundLayer

@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
	super.drawGuiContainerForegroundLayer(mouseX, mouseY);
	int[] data = ((ContainerBarrel) inventorySlots).data_a;
	this.renderHoveredToolTip(mouseX - guiLeft, mouseY - guiTop);
	if (mouseX > guiLeft + 62 && mouseX < guiLeft + 114 && mouseY > guiTop + 17 && mouseY < guiTop + 33) {
		FluidStack fstack = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null).drain(1000, false);
		if (fstack != null) {
			ArrayList<String> tooltip = new ArrayList<String>(2);
			String color = fstack.getFluid().getTemperature() > 600 ? TextFormatting.GOLD.toString() : fstack.getFluid().getTemperature() < 150 ? TextFormatting.AQUA.toString() : TextFormatting.DARK_AQUA.toString();
			tooltip.add(color + fstack.getLocalizedName());
			tooltip.add(TextFormatting.GRAY + I18n.format("fluid.quantity.mB", fstack.amount));
			drawHoveringText(tooltip, mouseX - guiLeft, mouseY - guiTop);
		} else {
			drawHoveringText(I18n.format("fluid.none"), mouseX - guiLeft, mouseY - guiTop);
		}
	} else if (mouseX > guiLeft + 134 && mouseX < guiLeft + 150 && mouseY > guiTop + 20 && mouseY < guiTop + 36) {
		String text = TextFormatting.YELLOW + I18n.format("tile.barrel.altar.working");
		if (data[3] == 0) text = TextFormatting.GREEN + I18n.format("tile.barrel.altar.none_required");
		else if (te.getAltar(false) == null)
			text = TextFormatting.DARK_RED + I18n.format("tile.barrel.altar.no_altar");
		else if (data[3] == data[1]) text = TextFormatting.GREEN + I18n.format("tile.barrel.altar.done");

		drawHoveringText(text, mouseX - guiLeft, mouseY - guiTop);
	}
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:26,代碼來源:GuiBarrel.java

示例2: getDebugInfoRight

protected <T extends Comparable<T>> List<String> getDebugInfoRight()
{
    long i = Runtime.getRuntime().maxMemory();
    long j = Runtime.getRuntime().totalMemory();
    long k = Runtime.getRuntime().freeMemory();
    long l = j - k;
    List<String> list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.glGetString(7936)}), GlStateManager.glGetString(7937), GlStateManager.glGetString(7938)});

    list.add("");
    list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false));

    if (this.mc.isReducedDebug())
    {
        return list;
    }
    else
    {
        if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK && this.mc.objectMouseOver.getBlockPos() != null)
        {
            BlockPos blockpos = this.mc.objectMouseOver.getBlockPos();
            IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);

            if (this.mc.theWorld.getWorldType() != WorldType.DEBUG_WORLD)
            {
                iblockstate = iblockstate.getActualState(this.mc.theWorld, blockpos);
            }

            list.add("");
            list.add(String.valueOf(Block.REGISTRY.getNameForObject(iblockstate.getBlock())));

            for (Entry < IProperty<?>, Comparable<? >> entry : iblockstate.getProperties().entrySet())
            {
                IProperty<T> iproperty = (IProperty)entry.getKey();
                T t = (T)entry.getValue();
                String s = iproperty.getName(t);

                if (Boolean.TRUE.equals(t))
                {
                    s = TextFormatting.GREEN + s;
                }
                else if (Boolean.FALSE.equals(t))
                {
                    s = TextFormatting.RED + s;
                }

                list.add(iproperty.getName() + ": " + s);
            }
        }

        return list;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:52,代碼來源:GuiOverlayDebug.java


注:本文中的net.minecraft.util.text.TextFormatting.GREEN屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。