當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。