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

The following are Jave code examples for showing how to use abs_int() 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: WorldGenBigTree.java   Source Code and License Vote up 5 votes
/**
 * Returns the absolute greatest distance in the BlockPos object.
 */
private int getGreatestDistance(BlockPos posIn)
{
    int i = MathHelper.abs_int(posIn.getX());
    int j = MathHelper.abs_int(posIn.getY());
    int k = MathHelper.abs_int(posIn.getZ());
    return k > i && k > j ? k : (j > i ? j : i);
}
 
Example 2
Project: DecompiledMinecraft   File: DedicatedServer.java   Source Code and License Vote up 5 votes
public boolean isBlockProtected(World worldIn, BlockPos pos, EntityPlayer playerIn)
{
    if (worldIn.provider.getDimensionId() != 0)
    {
        return false;
    }
    else if (this.getConfigurationManager().getOppedPlayers().isEmpty())
    {
        return false;
    }
    else if (this.getConfigurationManager().canSendCommands(playerIn.getGameProfile()))
    {
        return false;
    }
    else if (this.getSpawnProtectionSize() <= 0)
    {
        return false;
    }
    else
    {
        BlockPos blockpos = worldIn.getSpawnPoint();
        int i = MathHelper.abs_int(pos.getX() - blockpos.getX());
        int j = MathHelper.abs_int(pos.getZ() - blockpos.getZ());
        int k = Math.max(i, j);
        return k <= this.getSpawnProtectionSize();
    }
}
 
Example 3
Project: DecompiledMinecraft   File: WorldGenBigTree.java   Source Code and License Vote up 5 votes
/**
 * Returns the absolute greatest distance in the BlockPos object.
 */
private int getGreatestDistance(BlockPos posIn)
{
    int i = MathHelper.abs_int(posIn.getX());
    int j = MathHelper.abs_int(posIn.getY());
    int k = MathHelper.abs_int(posIn.getZ());
    return k > i && k > j ? k : (j > i ? j : i);
}
 
Example 4
Project: BaseClient   File: WorldGenBigTree.java   Source Code and License Vote up 5 votes
/**
 * Returns the absolute greatest distance in the BlockPos object.
 */
private int getGreatestDistance(BlockPos posIn)
{
    int i = MathHelper.abs_int(posIn.getX());
    int j = MathHelper.abs_int(posIn.getY());
    int k = MathHelper.abs_int(posIn.getZ());
    return k > i && k > j ? k : (j > i ? j : i);
}
 
Example 5
Project: BaseClient   File: RenderGlobal.java   Source Code and License Vote up 5 votes
private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_)
{
    BlockPos blockpos = p_181562_2_.getPositionOffset16(p_181562_3_);

    if (blockpos.getY() >= 0 && blockpos.getY() < 256)
    {
        int i = MathHelper.abs_int(p_181562_1_.getX() - blockpos.getX());
        int j = MathHelper.abs_int(p_181562_1_.getZ() - blockpos.getZ());

        if (Config.isFogOff())
        {
            if (i > this.renderDistance || j > this.renderDistance)
            {
                return null;
            }
        }
        else
        {
            int k = i * i + j * j;

            if (k > this.renderDistanceSq)
            {
                return null;
            }
        }

        return this.viewFrustum.getRenderChunk(blockpos);
    }
    else
    {
        return null;
    }
}
 
Example 6
Project: BaseClient   File: WorldGenBigTree.java   Source Code and License Vote up 5 votes
/**
 * Returns the absolute greatest distance in the BlockPos object.
 */
private int getGreatestDistance(BlockPos posIn)
{
    int i = MathHelper.abs_int(posIn.getX());
    int j = MathHelper.abs_int(posIn.getY());
    int k = MathHelper.abs_int(posIn.getZ());
    return k > i && k > j ? k : (j > i ? j : i);
}
 
Example 7
Project: BaseClient   File: RenderGlobal.java   Source Code and License Vote up 5 votes
private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_)
{
    BlockPos blockpos = p_181562_2_.getPositionOffset16(p_181562_3_);

    if (blockpos.getY() >= 0 && blockpos.getY() < 256)
    {
        int i = MathHelper.abs_int(p_181562_1_.getX() - blockpos.getX());
        int j = MathHelper.abs_int(p_181562_1_.getZ() - blockpos.getZ());

        if (Config.isFogOff())
        {
            if (i > this.renderDistance || j > this.renderDistance)
            {
                return null;
            }
        }
        else
        {
            int k = i * i + j * j;

            if (k > this.renderDistanceSq)
            {
                return null;
            }
        }

        return this.viewFrustum.getRenderChunk(blockpos);
    }
    else
    {
        return null;
    }
}
 
Example 8
Project: DecompiledMinecraft   File: RealmsMth.java   Source Code and License Vote up 4 votes
public static int abs(int p_abs_0_)
{
    return MathHelper.abs_int(p_abs_0_);
}
 
Example 9
Project: DecompiledMinecraft   File: RenderGlobal.java   Source Code and License Vote up 4 votes
private boolean isPositionInRenderChunk(BlockPos pos, RenderChunk renderChunkIn)
{
    BlockPos blockpos = renderChunkIn.getPosition();
    return MathHelper.abs_int(pos.getX() - blockpos.getX()) > 16 ? false : (MathHelper.abs_int(pos.getY() - blockpos.getY()) > 16 ? false : MathHelper.abs_int(pos.getZ() - blockpos.getZ()) <= 16);
}
 
Example 10
Project: DecompiledMinecraft   File: RenderGlobal.java   Source Code and License Vote up 4 votes
private RenderChunk func_181562_a(BlockPos p_181562_1_, RenderChunk p_181562_2_, EnumFacing p_181562_3_)
{
    BlockPos blockpos = p_181562_2_.func_181701_a(p_181562_3_);
    return MathHelper.abs_int(p_181562_1_.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= 0 && blockpos.getY() < 256 ? (MathHelper.abs_int(p_181562_1_.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
}
 
Example 11
Project: BaseClient   File: RealmsMth.java   Source Code and License Vote up 4 votes
public static int abs(int p_abs_0_)
{
    return MathHelper.abs_int(p_abs_0_);
}
 
Example 12
Project: BaseClient   File: RenderGlobal.java   Source Code and License Vote up 4 votes
private boolean isPositionInRenderChunk(BlockPos pos, RenderChunk renderChunkIn)
{
    BlockPos blockpos = renderChunkIn.getPosition();
    return MathHelper.abs_int(pos.getX() - blockpos.getX()) > 16 ? false : (MathHelper.abs_int(pos.getY() - blockpos.getY()) > 16 ? false : MathHelper.abs_int(pos.getZ() - blockpos.getZ()) <= 16);
}
 
Example 13
Project: BaseClient   File: RealmsMth.java   Source Code and License Vote up 4 votes
public static int abs(int p_abs_0_)
{
    return MathHelper.abs_int(p_abs_0_);
}
 
Example 14
Project: BaseClient   File: RenderGlobal.java   Source Code and License Vote up 4 votes
private boolean isPositionInRenderChunk(BlockPos pos, RenderChunk renderChunkIn)
{
    BlockPos blockpos = renderChunkIn.getPosition();
    return MathHelper.abs_int(pos.getX() - blockpos.getX()) > 16 ? false : (MathHelper.abs_int(pos.getY() - blockpos.getY()) > 16 ? false : MathHelper.abs_int(pos.getZ() - blockpos.getZ()) <= 16);
}