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


Java MathHelper.hsvToRGB方法代码示例

本文整理汇总了Java中net.minecraft.util.math.MathHelper.hsvToRGB方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.hsvToRGB方法的具体用法?Java MathHelper.hsvToRGB怎么用?Java MathHelper.hsvToRGB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.math.MathHelper的用法示例。


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

示例1: renderPathLine

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public void renderPathLine(float p_190067_1_, Path p_190067_2_)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);

    for (int i = 0; i < p_190067_2_.getCurrentPathLength(); ++i)
    {
        PathPoint pathpoint = p_190067_2_.getPathPointFromIndex(i);

        if (this.addDistanceToPlayer(pathpoint) <= 40.0F)
        {
            float f = (float)i / (float)p_190067_2_.getCurrentPathLength() * 0.33F;
            int j = i == 0 ? 0 : MathHelper.hsvToRGB(f, 0.9F, 0.9F);
            int k = j >> 16 & 255;
            int l = j >> 8 & 255;
            int i1 = j & 255;
            vertexbuffer.pos((double)pathpoint.xCoord - this.xo + 0.5D, (double)pathpoint.yCoord - this.yo + 0.5D, (double)pathpoint.zCoord - this.zo + 0.5D).color(k, l, i1, 255).endVertex();
        }
    }

    tessellator.draw();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:DebugRendererPathfinding.java

示例2: getSkyColorByTemp

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
 * takes temperature, returns color
 */
public int getSkyColorByTemp(float currentTemperature)
{
    currentTemperature = currentTemperature / 3.0F;
    currentTemperature = MathHelper.clamp(currentTemperature, -1.0F, 1.0F);
    return MathHelper.hsvToRGB(0.62222224F - currentTemperature * 0.05F, 0.5F + currentTemperature * 0.1F, 1.0F);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:Biome.java

示例3: getSkyColorByTemp

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
 * takes temperature, returns color
 */
@SideOnly(Side.CLIENT)
public int getSkyColorByTemp(float currentTemperature)
{
    currentTemperature = currentTemperature / 3.0F;
    currentTemperature = MathHelper.clamp_float(currentTemperature, -1.0F, 1.0F);
    return MathHelper.hsvToRGB(0.62222224F - currentTemperature * 0.05F, 0.5F + currentTemperature * 0.1F, 1.0F);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:Biome.java

示例4: getRGBDurabilityForDisplay

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
@Override
public int getRGBDurabilityForDisplay(ItemStack stack) {
	// a nice dark green
	return MathHelper.hsvToRGB(1.0F / 3.0F, 0.5F, 0.25F);
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:6,代码来源:ItemEnergyBase.java

示例5: renderItemOverlayIntoGUI

import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
 * Renders the stack size and/or damage bar for the given ItemStack.
 */
public void renderItemOverlayIntoGUI(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, @Nullable String text)
{
    if (!stack.func_190926_b())
    {
        if (stack.func_190916_E() != 1 || text != null)
        {
            String s = text == null ? String.valueOf(stack.func_190916_E()) : text;
            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableBlend();
            fr.drawStringWithShadow(s, (float)(xPosition + 19 - 2 - fr.getStringWidth(s)), (float)(yPosition + 6 + 3), 16777215);
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
            GlStateManager.enableBlend();
        }

        if (ReflectorForge.isItemDamaged(stack))
        {
            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableTexture2D();
            GlStateManager.disableAlpha();
            GlStateManager.disableBlend();
            Tessellator tessellator = Tessellator.getInstance();
            VertexBuffer vertexbuffer = tessellator.getBuffer();
            float f = (float)stack.getItemDamage();
            float f1 = (float)stack.getMaxDamage();
            float f2 = Math.max(0.0F, (f1 - f) / f1);
            int i = Math.round(13.0F - f * 13.0F / f1);
            int j = MathHelper.hsvToRGB(f2 / 3.0F, 1.0F, 1.0F);

            if (Reflector.ForgeItem_getDurabilityForDisplay.exists() && Reflector.ForgeItem_getRGBDurabilityForDisplay.exists())
            {
                double d0 = Reflector.callDouble(stack.getItem(), Reflector.ForgeItem_getDurabilityForDisplay, new Object[] {stack});
                int k = Reflector.callInt(stack.getItem(), Reflector.ForgeItem_getRGBDurabilityForDisplay, new Object[] {stack});
                i = Math.round(13.0F - (float)d0 * 13.0F);
                j = k;
            }

            if (Config.isCustomColors())
            {
                j = CustomColors.getDurabilityColor(f2, j);
            }

            this.draw(vertexbuffer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255);
            this.draw(vertexbuffer, xPosition + 2, yPosition + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255);
            GlStateManager.enableBlend();
            GlStateManager.enableAlpha();
            GlStateManager.enableTexture2D();
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
        }

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player;
        float f3 = entityplayersp == null ? 0.0F : entityplayersp.getCooldownTracker().getCooldown(stack.getItem(), Minecraft.getMinecraft().getRenderPartialTicks());

        if (f3 > 0.0F)
        {
            GlStateManager.disableLighting();
            GlStateManager.disableDepth();
            GlStateManager.disableTexture2D();
            Tessellator tessellator1 = Tessellator.getInstance();
            VertexBuffer vertexbuffer1 = tessellator1.getBuffer();
            this.draw(vertexbuffer1, xPosition, yPosition + MathHelper.floor(16.0F * (1.0F - f3)), 16, MathHelper.ceil(16.0F * f3), 255, 255, 255, 127);
            GlStateManager.enableTexture2D();
            GlStateManager.enableLighting();
            GlStateManager.enableDepth();
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:74,代码来源:RenderItem.java


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