本文整理汇总了Java中net.minecraft.util.math.MathHelper.abs_int方法的典型用法代码示例。如果您正苦于以下问题:Java MathHelper.abs_int方法的具体用法?Java MathHelper.abs_int怎么用?Java MathHelper.abs_int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.MathHelper
的用法示例。
在下文中一共展示了MathHelper.abs_int方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGreatestDistance
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* 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);
}
示例2: getRenderChunkOffset
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
/**
* Returns RenderChunk offset from given RenderChunk in given direction, or null if it can't be seen by player at
* given BlockPos.
*/
@Nullable
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, EnumFacing facing)
{
BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
return MathHelper.abs_int(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (blockpos.getY() >= 0 && blockpos.getY() < 256 ? (MathHelper.abs_int(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
}
示例3: isBlockProtected
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public boolean isBlockProtected(World worldIn, BlockPos pos, EntityPlayer playerIn)
{
if (worldIn.provider.getDimension() != 0)
{
return false;
}
else if (this.getPlayerList().getOppedPlayers().isEmpty())
{
return false;
}
else if (this.getPlayerList().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();
}
}
示例4: generate
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public boolean generate(World worldIn, Random rand, BlockPos position)
{
if (this.spike == null)
{
throw new IllegalStateException("Decoration requires priming with a spike");
}
else
{
int i = this.spike.getRadius();
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(new BlockPos(position.getX() - i, 0, position.getZ() - i), new BlockPos(position.getX() + i, this.spike.getHeight() + 10, position.getZ() + i)))
{
if (blockpos$mutableblockpos.distanceSq((double)position.getX(), (double)blockpos$mutableblockpos.getY(), (double)position.getZ()) <= (double)(i * i + 1) && blockpos$mutableblockpos.getY() < this.spike.getHeight())
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.OBSIDIAN.getDefaultState());
}
else if (blockpos$mutableblockpos.getY() > 65)
{
this.setBlockAndNotifyAdequately(worldIn, blockpos$mutableblockpos, Blocks.AIR.getDefaultState());
}
}
if (this.spike.isGuarded())
{
for (int j = -2; j <= 2; ++j)
{
for (int k = -2; k <= 2; ++k)
{
if (MathHelper.abs_int(j) == 2 || MathHelper.abs_int(k) == 2)
{
this.setBlockAndNotifyAdequately(worldIn, new BlockPos(position.getX() + j, this.spike.getHeight(), position.getZ() + k), Blocks.IRON_BARS.getDefaultState());
this.setBlockAndNotifyAdequately(worldIn, new BlockPos(position.getX() + j, this.spike.getHeight() + 1, position.getZ() + k), Blocks.IRON_BARS.getDefaultState());
this.setBlockAndNotifyAdequately(worldIn, new BlockPos(position.getX() + j, this.spike.getHeight() + 2, position.getZ() + k), Blocks.IRON_BARS.getDefaultState());
}
this.setBlockAndNotifyAdequately(worldIn, new BlockPos(position.getX() + j, this.spike.getHeight() + 3, position.getZ() + k), Blocks.IRON_BARS.getDefaultState());
}
}
}
EntityEnderCrystal entityendercrystal = new EntityEnderCrystal(worldIn);
entityendercrystal.setBeamTarget(this.beamTarget);
entityendercrystal.setEntityInvulnerable(this.crystalInvulnerable);
entityendercrystal.setLocationAndAngles((double)((float)position.getX() + 0.5F), (double)(this.spike.getHeight() + 1), (double)((float)position.getZ() + 0.5F), rand.nextFloat() * 360.0F, 0.0F);
worldIn.spawnEntityInWorld(entityendercrystal);
this.setBlockAndNotifyAdequately(worldIn, new BlockPos(position.getX(), this.spike.getHeight(), position.getZ()), Blocks.BEDROCK.getDefaultState());
return true;
}
}
示例5: abs
import net.minecraft.util.math.MathHelper; //导入方法依赖的package包/类
public static int abs(int p_abs_0_)
{
return MathHelper.abs_int(p_abs_0_);
}