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

The following are Jave code examples for showing how to use bucketInt() 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.
Example 1
Project: DecompiledMinecraft   File: ViewFrustum.java   Source Code and License Vote up 5 votes
protected RenderChunk getRenderChunk(BlockPos pos)
{
    int i = MathHelper.bucketInt(pos.getX(), 16);
    int j = MathHelper.bucketInt(pos.getY(), 16);
    int k = MathHelper.bucketInt(pos.getZ(), 16);

    if (j >= 0 && j < this.countChunksY)
    {
        i = i % this.countChunksX;

        if (i < 0)
        {
            i += this.countChunksX;
        }

        k = k % this.countChunksZ;

        if (k < 0)
        {
            k += this.countChunksZ;
        }

        int l = (k * this.countChunksY + j) * this.countChunksX + i;
        return this.renderChunks[l];
    }
    else
    {
        return null;
    }
}
 
Example 2
Project: BaseClient   File: ViewFrustum.java   Source Code and License Vote up 5 votes
protected RenderChunk getRenderChunk(BlockPos pos)
{
    int i = MathHelper.bucketInt(pos.getX(), 16);
    int j = MathHelper.bucketInt(pos.getY(), 16);
    int k = MathHelper.bucketInt(pos.getZ(), 16);

    if (j >= 0 && j < this.countChunksY)
    {
        i = i % this.countChunksX;

        if (i < 0)
        {
            i += this.countChunksX;
        }

        k = k % this.countChunksZ;

        if (k < 0)
        {
            k += this.countChunksZ;
        }

        int l = (k * this.countChunksY + j) * this.countChunksX + i;
        return this.renderChunks[l];
    }
    else
    {
        return null;
    }
}
 
Example 3
Project: BaseClient   File: ViewFrustum.java   Source Code and License Vote up 5 votes
protected RenderChunk getRenderChunk(BlockPos pos)
{
    int i = MathHelper.bucketInt(pos.getX(), 16);
    int j = MathHelper.bucketInt(pos.getY(), 16);
    int k = MathHelper.bucketInt(pos.getZ(), 16);

    if (j >= 0 && j < this.countChunksY)
    {
        i = i % this.countChunksX;

        if (i < 0)
        {
            i += this.countChunksX;
        }

        k = k % this.countChunksZ;

        if (k < 0)
        {
            k += this.countChunksZ;
        }

        int l = (k * this.countChunksY + j) * this.countChunksX + i;
        return this.renderChunks[l];
    }
    else
    {
        return null;
    }
}
 
Example 4
Project: DecompiledMinecraft   File: RealmsMth.java   Source Code and License Vote up 4 votes
public static int intFloorDiv(int p_intFloorDiv_0_, int p_intFloorDiv_1_)
{
    return MathHelper.bucketInt(p_intFloorDiv_0_, p_intFloorDiv_1_);
}
 
Example 5
Project: DecompiledMinecraft   File: ViewFrustum.java   Source Code and License Vote up 4 votes
public void markBlocksForUpdate(int fromX, int fromY, int fromZ, int toX, int toY, int toZ)
{
    int i = MathHelper.bucketInt(fromX, 16);
    int j = MathHelper.bucketInt(fromY, 16);
    int k = MathHelper.bucketInt(fromZ, 16);
    int l = MathHelper.bucketInt(toX, 16);
    int i1 = MathHelper.bucketInt(toY, 16);
    int j1 = MathHelper.bucketInt(toZ, 16);

    for (int k1 = i; k1 <= l; ++k1)
    {
        int l1 = k1 % this.countChunksX;

        if (l1 < 0)
        {
            l1 += this.countChunksX;
        }

        for (int i2 = j; i2 <= i1; ++i2)
        {
            int j2 = i2 % this.countChunksY;

            if (j2 < 0)
            {
                j2 += this.countChunksY;
            }

            for (int k2 = k; k2 <= j1; ++k2)
            {
                int l2 = k2 % this.countChunksZ;

                if (l2 < 0)
                {
                    l2 += this.countChunksZ;
                }

                int i3 = (l2 * this.countChunksY + j2) * this.countChunksX + l1;
                RenderChunk renderchunk = this.renderChunks[i3];
                renderchunk.setNeedsUpdate(true);
            }
        }
    }
}
 
Example 6
Project: BaseClient   File: RealmsMth.java   Source Code and License Vote up 4 votes
public static int intFloorDiv(int p_intFloorDiv_0_, int p_intFloorDiv_1_)
{
    return MathHelper.bucketInt(p_intFloorDiv_0_, p_intFloorDiv_1_);
}
 
Example 7
Project: BaseClient   File: ViewFrustum.java   Source Code and License Vote up 4 votes
public void markBlocksForUpdate(int fromX, int fromY, int fromZ, int toX, int toY, int toZ)
{
    int i = MathHelper.bucketInt(fromX, 16);
    int j = MathHelper.bucketInt(fromY, 16);
    int k = MathHelper.bucketInt(fromZ, 16);
    int l = MathHelper.bucketInt(toX, 16);
    int i1 = MathHelper.bucketInt(toY, 16);
    int j1 = MathHelper.bucketInt(toZ, 16);

    for (int k1 = i; k1 <= l; ++k1)
    {
        int l1 = k1 % this.countChunksX;

        if (l1 < 0)
        {
            l1 += this.countChunksX;
        }

        for (int i2 = j; i2 <= i1; ++i2)
        {
            int j2 = i2 % this.countChunksY;

            if (j2 < 0)
            {
                j2 += this.countChunksY;
            }

            for (int k2 = k; k2 <= j1; ++k2)
            {
                int l2 = k2 % this.countChunksZ;

                if (l2 < 0)
                {
                    l2 += this.countChunksZ;
                }

                int i3 = (l2 * this.countChunksY + j2) * this.countChunksX + l1;
                RenderChunk renderchunk = this.renderChunks[i3];
                renderchunk.setNeedsUpdate(true);
            }
        }
    }
}
 
Example 8
Project: BaseClient   File: RealmsMth.java   Source Code and License Vote up 4 votes
public static int intFloorDiv(int p_intFloorDiv_0_, int p_intFloorDiv_1_)
{
    return MathHelper.bucketInt(p_intFloorDiv_0_, p_intFloorDiv_1_);
}
 
Example 9
Project: BaseClient   File: ViewFrustum.java   Source Code and License Vote up 4 votes
public void markBlocksForUpdate(int fromX, int fromY, int fromZ, int toX, int toY, int toZ)
{
    int i = MathHelper.bucketInt(fromX, 16);
    int j = MathHelper.bucketInt(fromY, 16);
    int k = MathHelper.bucketInt(fromZ, 16);
    int l = MathHelper.bucketInt(toX, 16);
    int i1 = MathHelper.bucketInt(toY, 16);
    int j1 = MathHelper.bucketInt(toZ, 16);

    for (int k1 = i; k1 <= l; ++k1)
    {
        int l1 = k1 % this.countChunksX;

        if (l1 < 0)
        {
            l1 += this.countChunksX;
        }

        for (int i2 = j; i2 <= i1; ++i2)
        {
            int j2 = i2 % this.countChunksY;

            if (j2 < 0)
            {
                j2 += this.countChunksY;
            }

            for (int k2 = k; k2 <= j1; ++k2)
            {
                int l2 = k2 % this.countChunksZ;

                if (l2 < 0)
                {
                    l2 += this.countChunksZ;
                }

                int i3 = (l2 * this.countChunksY + j2) * this.countChunksX + l1;
                RenderChunk renderchunk = this.renderChunks[i3];
                renderchunk.setNeedsUpdate(true);
            }
        }
    }
}