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


Java MathHelper.abs方法代码示例

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


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

示例1: getFacingFromEntity

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
{
    if (MathHelper.abs((float)entityIn.posX - (float)clickedBlock.getX()) < 2.0F && MathHelper.abs((float)entityIn.posZ - (float)clickedBlock.getZ()) < 2.0F)
    {
        double d0 = entityIn.posY + (double)entityIn.getEyeHeight();

        if (d0 - (double)clickedBlock.getY() > 2.0D)
        {
            return EnumFacing.UP;
        }

        if ((double)clickedBlock.getY() - d0 > 0.0D)
        {
            return EnumFacing.DOWN;
        }
    }

    return entityIn.getHorizontalFacing().getOpposite();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:BlockPistonBase.java

示例2: func_178104_a

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private void func_178104_a(AbstractClientPlayer clientPlayer, float p_178104_2_)
{
    float f = (float)clientPlayer.getItemInUseCount() - p_178104_2_ + 1.0F;
    float f1 = f / (float)this.itemToRender.getMaxItemUseDuration();
    float f2 = MathHelper.abs(MathHelper.cos(f / 4.0F * (float)Math.PI) * 0.1F);

    if (f1 >= 0.8F)
    {
        f2 = 0.0F;
    }

    GlStateManager.translate(0.0F, f2, 0.0F);
    float f3 = 1.0F - (float)Math.pow((double)f1, 27.0D);
    GlStateManager.translate(f3 * 0.6F, f3 * -0.5F, f3 * 0.0F);
    GlStateManager.rotate(f3 * 90.0F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(f3 * 10.0F, 1.0F, 0.0F, 0.0F);
    GlStateManager.rotate(f3 * 30.0F, 0.0F, 0.0F, 1.0F);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:19,代码来源:ItemRenderer.java

示例3: parseAngle

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private float parseAngle(JsonObject p_178255_1_)
{
    float f = JsonUtils.getFloat(p_178255_1_, "angle");

    if (f != 0.0F && MathHelper.abs(f) != 22.5F && MathHelper.abs(f) != 45.0F)
    {
        throw new JsonParseException("Invalid rotation " + f + " found, only -45/-22.5/0/22.5/45 allowed");
    }
    else
    {
        return f;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:BlockPart.java

示例4: abs

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
public static float abs(float p_abs_0_)
{
    return MathHelper.abs(p_abs_0_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:RealmsMth.java

示例5: drawScreen

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
/**
 * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    GlStateManager.disableAlpha();
    this.renderSkybox(mouseX, mouseY, partialTicks);
    GlStateManager.enableAlpha();
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    int i = 274;
    int j = this.width / 2 - i / 2;
    int k = 30;
    this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
    this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
    this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

    if ((double)this.updateCounter < 1.0E-4D)
    {
        this.drawTexturedModalRect(j + 0, k + 0, 0, 0, 99, 44);
        this.drawTexturedModalRect(j + 99, k + 0, 129, 0, 27, 44);
        this.drawTexturedModalRect(j + 99 + 26, k + 0, 126, 0, 3, 44);
        this.drawTexturedModalRect(j + 99 + 26 + 3, k + 0, 99, 0, 26, 44);
        this.drawTexturedModalRect(j + 155, k + 0, 0, 45, 155, 44);
    }
    else
    {
        this.drawTexturedModalRect(j + 0, k + 0, 0, 0, 155, 44);
        this.drawTexturedModalRect(j + 155, k + 0, 0, 45, 155, 44);
    }

    GlStateManager.pushMatrix();
    GlStateManager.translate((float)(this.width / 2 + 90), 70.0F, 0.0F);
    GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F);
    float f = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F);
    f = f * 100.0F / (float)(this.fontRendererObj.getStringWidth(this.splashText) + 32);
    GlStateManager.scale(f, f, f);
    this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256);
    GlStateManager.popMatrix();
    String s = "Minecraft 1.8.8";

    if (this.mc.isDemo())
    {
        s = s + " Demo";
    }

    this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1);
    String s1 = "Copyright Mojang AB. Do not distribute!";
    this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1);

    if (this.openGLWarning1 != null && this.openGLWarning1.length() > 0)
    {
        drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512);
        this.drawString(this.fontRendererObj, this.openGLWarning1, this.field_92022_t, this.field_92021_u, -1);
        this.drawString(this.fontRendererObj, this.openGLWarning2, (this.width - this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, -1);
    }

    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:61,代码来源:GuiMainMenu.java

示例6: equalsDelta

import net.minecraft.util.MathHelper; //导入方法依赖的package包/类
private boolean equalsDelta(float p_equalsDelta_1_, float p_equalsDelta_2_, float p_equalsDelta_3_)
{
    float f = MathHelper.abs(p_equalsDelta_1_ - p_equalsDelta_2_);
    return f < p_equalsDelta_3_;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:6,代码来源:NaturalProperties.java


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