Java Code Examples for net.minecraft.util.MathHelper.truncateDoubleToInt()

The following are Jave code examples for showing how to use truncateDoubleToInt() of the net.minecraft.util.MathHelper class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: RealmsMth.java   View Source Code Vote up 4 votes
public static int fastFloor(double p_fastFloor_0_)
{
    return MathHelper.truncateDoubleToInt(p_fastFloor_0_);
}
 
Example 2
Project: DecompiledMinecraft   File: TileEntityEnchantmentTableRenderer.java   View Source Code Vote up 4 votes
public void renderTileEntityAt(TileEntityEnchantmentTable te, double x, double y, double z, float partialTicks, int destroyStage)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F, (float)z + 0.5F);
    float f = (float)te.tickCount + partialTicks;
    GlStateManager.translate(0.0F, 0.1F + MathHelper.sin(f * 0.1F) * 0.01F, 0.0F);
    float f1;

    for (f1 = te.bookRotation - te.bookRotationPrev; f1 >= (float)Math.PI; f1 -= ((float)Math.PI * 2F))
    {
        ;
    }

    while (f1 < -(float)Math.PI)
    {
        f1 += ((float)Math.PI * 2F);
    }

    float f2 = te.bookRotationPrev + f1 * partialTicks;
    GlStateManager.rotate(-f2 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(80.0F, 0.0F, 0.0F, 1.0F);
    this.bindTexture(TEXTURE_BOOK);
    float f3 = te.pageFlipPrev + (te.pageFlip - te.pageFlipPrev) * partialTicks + 0.25F;
    float f4 = te.pageFlipPrev + (te.pageFlip - te.pageFlipPrev) * partialTicks + 0.75F;
    f3 = (f3 - (float)MathHelper.truncateDoubleToInt((double)f3)) * 1.6F - 0.3F;
    f4 = (f4 - (float)MathHelper.truncateDoubleToInt((double)f4)) * 1.6F - 0.3F;

    if (f3 < 0.0F)
    {
        f3 = 0.0F;
    }

    if (f4 < 0.0F)
    {
        f4 = 0.0F;
    }

    if (f3 > 1.0F)
    {
        f3 = 1.0F;
    }

    if (f4 > 1.0F)
    {
        f4 = 1.0F;
    }

    float f5 = te.bookSpreadPrev + (te.bookSpread - te.bookSpreadPrev) * partialTicks;
    GlStateManager.enableCull();
    this.field_147541_c.render((Entity)null, f, f3, f4, f5, 0.0F, 0.0625F);
    GlStateManager.popMatrix();
}
 
Example 3
Project: BaseClient   File: RealmsMth.java   View Source Code Vote up 4 votes
public static int fastFloor(double p_fastFloor_0_)
{
    return MathHelper.truncateDoubleToInt(p_fastFloor_0_);
}
 
Example 4
Project: BaseClient   File: TileEntityEnchantmentTableRenderer.java   View Source Code Vote up 4 votes
public void renderTileEntityAt(TileEntityEnchantmentTable te, double x, double y, double z, float partialTicks, int destroyStage)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F, (float)z + 0.5F);
    float f = (float)te.tickCount + partialTicks;
    GlStateManager.translate(0.0F, 0.1F + MathHelper.sin(f * 0.1F) * 0.01F, 0.0F);
    float f1;

    for (f1 = te.bookRotation - te.bookRotationPrev; f1 >= (float)Math.PI; f1 -= ((float)Math.PI * 2F))
    {
        ;
    }

    while (f1 < -(float)Math.PI)
    {
        f1 += ((float)Math.PI * 2F);
    }

    float f2 = te.bookRotationPrev + f1 * partialTicks;
    GlStateManager.rotate(-f2 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(80.0F, 0.0F, 0.0F, 1.0F);
    this.bindTexture(TEXTURE_BOOK);
    float f3 = te.pageFlipPrev + (te.pageFlip - te.pageFlipPrev) * partialTicks + 0.25F;
    float f4 = te.pageFlipPrev + (te.pageFlip - te.pageFlipPrev) * partialTicks + 0.75F;
    f3 = (f3 - (float)MathHelper.truncateDoubleToInt((double)f3)) * 1.6F - 0.3F;
    f4 = (f4 - (float)MathHelper.truncateDoubleToInt((double)f4)) * 1.6F - 0.3F;

    if (f3 < 0.0F)
    {
        f3 = 0.0F;
    }

    if (f4 < 0.0F)
    {
        f4 = 0.0F;
    }

    if (f3 > 1.0F)
    {
        f3 = 1.0F;
    }

    if (f4 > 1.0F)
    {
        f4 = 1.0F;
    }

    float f5 = te.bookSpreadPrev + (te.bookSpread - te.bookSpreadPrev) * partialTicks;
    GlStateManager.enableCull();
    this.field_147541_c.render((Entity)null, f, f3, f4, f5, 0.0F, 0.0625F);
    GlStateManager.popMatrix();
}
 
Example 5
Project: BaseClient   File: RealmsMth.java   View Source Code Vote up 4 votes
public static int fastFloor(double p_fastFloor_0_)
{
    return MathHelper.truncateDoubleToInt(p_fastFloor_0_);
}
 
Example 6
Project: BaseClient   File: TileEntityEnchantmentTableRenderer.java   View Source Code Vote up 4 votes
public void renderTileEntityAt(TileEntityEnchantmentTable te, double x, double y, double z, float partialTicks, int destroyStage)
{
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)x + 0.5F, (float)y + 0.75F, (float)z + 0.5F);
    float f = (float)te.tickCount + partialTicks;
    GlStateManager.translate(0.0F, 0.1F + MathHelper.sin(f * 0.1F) * 0.01F, 0.0F);
    float f1;

    for (f1 = te.bookRotation - te.bookRotationPrev; f1 >= (float)Math.PI; f1 -= ((float)Math.PI * 2F))
    {
        ;
    }

    while (f1 < -(float)Math.PI)
    {
        f1 += ((float)Math.PI * 2F);
    }

    float f2 = te.bookRotationPrev + f1 * partialTicks;
    GlStateManager.rotate(-f2 * 180.0F / (float)Math.PI, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(80.0F, 0.0F, 0.0F, 1.0F);
    this.bindTexture(TEXTURE_BOOK);
    float f3 = te.pageFlipPrev + (te.pageFlip - te.pageFlipPrev) * partialTicks + 0.25F;
    float f4 = te.pageFlipPrev + (te.pageFlip - te.pageFlipPrev) * partialTicks + 0.75F;
    f3 = (f3 - (float)MathHelper.truncateDoubleToInt((double)f3)) * 1.6F - 0.3F;
    f4 = (f4 - (float)MathHelper.truncateDoubleToInt((double)f4)) * 1.6F - 0.3F;

    if (f3 < 0.0F)
    {
        f3 = 0.0F;
    }

    if (f4 < 0.0F)
    {
        f4 = 0.0F;
    }

    if (f3 > 1.0F)
    {
        f3 = 1.0F;
    }

    if (f4 > 1.0F)
    {
        f4 = 1.0F;
    }

    float f5 = te.bookSpreadPrev + (te.bookSpread - te.bookSpreadPrev) * partialTicks;
    GlStateManager.enableCull();
    this.field_147541_c.render((Entity)null, f, f3, f4, f5, 0.0F, 0.0625F);
    GlStateManager.popMatrix();
}