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


Java MathHelper.clamp_float方法代码示例

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


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

示例1: mousePressed

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Returns true if the mouse has been pressed on this control. Equivalent of MouseListener.mousePressed(MouseEvent
 * e).
 */
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY)
{
    if (super.mousePressed(mc, mouseX, mouseY))
    {
        this.sliderValue = (float)(mouseX - (this.xPosition + 4)) / (float)(this.width - 8);
        this.sliderValue = MathHelper.clamp_float(this.sliderValue, 0.0F, 1.0F);
        mc.gameSettings.setOptionFloatValue(this.options, this.options.denormalizeValue(this.sliderValue));
        this.displayString = mc.gameSettings.getKeyBinding(this.options);
        this.dragging = true;
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:21,代码来源:GuiOptionSlider.java

示例2: handleMouseInput

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Handles mouse input.
 */
public void handleMouseInput() throws IOException
{
    super.handleMouseInput();
    int i = Mouse.getEventDWheel();

    if (i != 0 && this.needsScrollBars())
    {
        int j = ((GuiContainerCreative.ContainerCreative)this.inventorySlots).itemList.size() / 9 - 5;

        if (i > 0)
        {
            i = 1;
        }

        if (i < 0)
        {
            i = -1;
        }

        this.currentScroll = (float)((double)this.currentScroll - (double)i / (double)j);
        this.currentScroll = MathHelper.clamp_float(this.currentScroll, 0.0F, 1.0F);
        ((GuiContainerCreative.ContainerCreative)this.inventorySlots).scrollTo(this.currentScroll);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:GuiContainerCreative.java

示例3: calculateAdditionalDifficulty

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private float calculateAdditionalDifficulty(EnumDifficulty difficulty, long worldTime, long chunkInhabitedTime, float moonPhaseFactor)
{
    if (difficulty == EnumDifficulty.PEACEFUL)
    {
        return 0.0F;
    }
    else
    {
        boolean flag = difficulty == EnumDifficulty.HARD;
        float f = 0.75F;
        float f1 = MathHelper.clamp_float(((float)worldTime + -72000.0F) / 1440000.0F, 0.0F, 1.0F) * 0.25F;
        f = f + f1;
        float f2 = 0.0F;
        f2 = f2 + MathHelper.clamp_float((float)chunkInhabitedTime / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F);
        f2 = f2 + MathHelper.clamp_float(moonPhaseFactor * 0.25F, 0.0F, f1);

        if (difficulty == EnumDifficulty.EASY)
        {
            f2 *= 0.5F;
        }

        f = f + f2;
        return (float)difficulty.getDifficultyId() * f;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:26,代码来源:DifficultyInstance.java

示例4: renderParticle

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Renders the particle
 */
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_)
{
    float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    this.particleScale = this.field_70569_a * f;
    super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:EntityCloudFX.java

示例5: getFogColor

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Return Vec3D with biome specific fog color
 */
public Vec3 getFogColor(float p_76562_1_, float p_76562_2_)
{
    int i = 10518688;
    float f = MathHelper.cos(p_76562_1_ * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    float f1 = (float)(i >> 16 & 255) / 255.0F;
    float f2 = (float)(i >> 8 & 255) / 255.0F;
    float f3 = (float)(i & 255) / 255.0F;
    f1 = f1 * (f * 0.0F + 0.15F);
    f2 = f2 * (f * 0.0F + 0.15F);
    f3 = f3 * (f * 0.0F + 0.15F);
    return new Vec3((double)f1, (double)f2, (double)f3);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:WorldProviderEnd.java

示例6: getCloudColour

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public Vec3 getCloudColour(float partialTicks)
{
    float f = this.getCelestialAngle(partialTicks);
    float f1 = MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
    f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
    float f2 = (float)(this.cloudColour >> 16 & 255L) / 255.0F;
    float f3 = (float)(this.cloudColour >> 8 & 255L) / 255.0F;
    float f4 = (float)(this.cloudColour & 255L) / 255.0F;
    float f5 = this.getRainStrength(partialTicks);

    if (f5 > 0.0F)
    {
        float f6 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.6F;
        float f7 = 1.0F - f5 * 0.95F;
        f2 = f2 * f7 + f6 * (1.0F - f7);
        f3 = f3 * f7 + f6 * (1.0F - f7);
        f4 = f4 * f7 + f6 * (1.0F - f7);
    }

    f2 = f2 * (f1 * 0.9F + 0.1F);
    f3 = f3 * (f1 * 0.9F + 0.1F);
    f4 = f4 * (f1 * 0.85F + 0.15F);
    float f9 = this.getThunderStrength(partialTicks);

    if (f9 > 0.0F)
    {
        float f10 = (f2 * 0.3F + f3 * 0.59F + f4 * 0.11F) * 0.2F;
        float f8 = 1.0F - f9 * 0.95F;
        f2 = f2 * f8 + f10 * (1.0F - f8);
        f3 = f3 * f8 + f10 * (1.0F - f8);
        f4 = f4 * f8 + f10 * (1.0F - f8);
    }

    return new Vec3((double)f2, (double)f3, (double)f4);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:36,代码来源:World.java

示例7: clicked

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public void clicked(int p_clicked_1_, int p_clicked_2_)
{
    this.value = (float)(p_clicked_1_ - (this.getProxy().xPosition + 4)) / (float)(this.getProxy().getButtonWidth() - 8);
    this.value = MathHelper.clamp_float(this.value, 0.0F, 1.0F);
    this.clicked(this.toValue(this.value));
    this.getProxy().displayString = this.getMessage();
    this.sliding = true;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:RealmsSliderButton.java

示例8: preRenderCallback

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime
 */
protected void preRenderCallback(EntityCreeper entitylivingbaseIn, float partialTickTime)
{
    float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);
    float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    f = f * f;
    f = f * f;
    float f2 = (1.0F + f * 0.4F) * f1;
    float f3 = (1.0F + f * 0.1F) / f1;
    GlStateManager.scale(f2, f3, f2);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:RenderCreeper.java

示例9: deserialize

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public ItemTransformVec3f deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
    JsonObject jsonobject = p_deserialize_1_.getAsJsonObject();
    Vector3f vector3f = this.parseVector3f(jsonobject, "rotation", ROTATION_DEFAULT);
    Vector3f vector3f1 = this.parseVector3f(jsonobject, "translation", TRANSLATION_DEFAULT);
    vector3f1.scale(0.0625F);
    vector3f1.x = MathHelper.clamp_float(vector3f1.x, -1.5F, 1.5F);
    vector3f1.y = MathHelper.clamp_float(vector3f1.y, -1.5F, 1.5F);
    vector3f1.z = MathHelper.clamp_float(vector3f1.z, -1.5F, 1.5F);
    Vector3f vector3f2 = this.parseVector3f(jsonobject, "scale", SCALE_DEFAULT);
    vector3f2.x = MathHelper.clamp_float(vector3f2.x, -4.0F, 4.0F);
    vector3f2.y = MathHelper.clamp_float(vector3f2.y, -4.0F, 4.0F);
    vector3f2.z = MathHelper.clamp_float(vector3f2.z, -4.0F, 4.0F);
    return new ItemTransformVec3f(vector3f, vector3f1, vector3f2);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:ItemTransformVec3f.java

示例10: renderParticle

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Renders the particle
 */
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_)
{
    float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    this.particleScale = this.noteParticleScale * f;
    super.renderParticle(worldRendererIn, entityIn, partialTicks, p_180434_4_, p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:EntityNoteFX.java

示例11: func_180560_a

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
protected void func_180560_a(EntityMinecartTNT minecart, float partialTicks, IBlockState state)
{
    int i = minecart.getFuseTicks();

    if (i > -1 && (float)i - partialTicks + 1.0F < 10.0F)
    {
        float f = 1.0F - ((float)i - partialTicks + 1.0F) / 10.0F;
        f = MathHelper.clamp_float(f, 0.0F, 1.0F);
        f = f * f;
        f = f * f;
        float f1 = 1.0F + f * 0.3F;
        GlStateManager.scale(f1, f1, f1);
    }

    super.func_180560_a(minecart, partialTicks, state);

    if (i > -1 && i / 5 % 2 == 0)
    {
        BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
        GlStateManager.disableTexture2D();
        GlStateManager.disableLighting();
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(770, 772);
        GlStateManager.color(1.0F, 1.0F, 1.0F, (1.0F - ((float)i - partialTicks + 1.0F) / 100.0F) * 0.8F);
        GlStateManager.pushMatrix();
        blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getDefaultState(), 1.0F);
        GlStateManager.popMatrix();
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.disableBlend();
        GlStateManager.enableLighting();
        GlStateManager.enableTexture2D();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:34,代码来源:RenderTntMinecart.java

示例12: getSkyColorByTemp

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

示例13: getBrightnessForRender

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public int getBrightnessForRender(float partialTicks)
{
    float f = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
    f = MathHelper.clamp_float(f, 0.0F, 1.0F);
    int i = super.getBrightnessForRender(partialTicks);
    int j = 240;
    int k = i >> 16 & 255;
    return j | k << 16;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:EntityLavaFX.java

示例14: getSunBrightness

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Returns the sun brightness - checks time of day, rain and thunder
 */
public float getSunBrightness(float p_72971_1_)
{
    float f = this.getCelestialAngle(p_72971_1_);
    float f1 = 1.0F - (MathHelper.cos(f * (float)Math.PI * 2.0F) * 2.0F + 0.2F);
    f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
    f1 = 1.0F - f1;
    f1 = (float)((double)f1 * (1.0D - (double)(this.getRainStrength(p_72971_1_) * 5.0F) / 16.0D));
    f1 = (float)((double)f1 * (1.0D - (double)(this.getThunderStrength(p_72971_1_) * 5.0F) / 16.0D));
    return f1 * 0.8F + 0.2F;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:World.java

示例15: func_175265_c

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private float func_175265_c()
{
    long i = this.field_175270_h - Minecraft.getSystemTime() + 5000L;
    return MathHelper.clamp_float((float)i / 2000.0F, 0.0F, 1.0F);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:6,代码来源:GuiSpectator.java


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