本文整理汇总了Java中net.minecraft.util.math.BlockPos.getZ方法的典型用法代码示例。如果您正苦于以下问题:Java BlockPos.getZ方法的具体用法?Java BlockPos.getZ怎么用?Java BlockPos.getZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.util.math.BlockPos
的用法示例。
在下文中一共展示了BlockPos.getZ方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Area
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private Area(BlockPos start, BlockPos end)
{
int startX = start.getX();
int startY = start.getY();
int startZ = start.getZ();
int endX = end.getX();
int endY = end.getY();
int endZ = end.getZ();
minX = Math.min(startX, endX);
minY = Math.min(startY, endY);
minZ = Math.min(startZ, endZ);
sizeX = Math.abs(startX - endX);
sizeY = Math.abs(startY - endY);
sizeZ = Math.abs(startZ - endZ);
totalBlocks = (sizeX + 1) * (sizeY + 1) * (sizeZ + 1);
scanSpeed = WMath.clamp(totalBlocks / 30, 1, 1024);
iterator = BlockPos.getAllInBox(start, end).iterator();
}
示例2: getTopSolidOrLiquidBlock
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Finds the highest block on the x and z coordinate that is solid or liquid, and returns its y coord.
*/
public BlockPos getTopSolidOrLiquidBlock(BlockPos pos)
{
Chunk chunk = this.getChunkFromBlockCoords(pos);
BlockPos blockpos;
BlockPos blockpos1;
for (blockpos = new BlockPos(pos.getX(), chunk.getTopFilledSegment() + 16, pos.getZ()); blockpos.getY() >= 0; blockpos = blockpos1)
{
blockpos1 = blockpos.down();
IBlockState state = chunk.getBlockState(blockpos1);
if (state.getMaterial().blocksMovement() && !state.getBlock().isLeaves(state, this, blockpos1) && !state.getBlock().isFoliage(this, blockpos1))
{
break;
}
}
return blockpos;
}
示例3: cast
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
@Override
public void cast(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
World world = sender.getEntityWorld();
BlockPos source = sender.getPosition();
for (BlockPos pos : BlockPos.getAllInBox(source.add(5, 5, 5), source.add(-5, -5, -5))) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileCandle && !((TileCandle) tile).isLit()) {
for (int i = 0; i < 5; i++) {
double x = pos.getX() + world.rand.nextFloat();
double y = pos.getY() + world.rand.nextFloat();
double z = pos.getZ() + world.rand.nextFloat();
world.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0);
}
((TileCandle) tile).litCandle();
PacketHandler.updateToNearbyPlayers(world, pos);
}
}
EnergyHandler.addEnergy((EntityPlayer) sender, 800);
}
示例4: getRandomLocation
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public static BlockPos getRandomLocation(BlockPos around) {
int fifthRadius = NemesisConfig.NEMESIS_SETTLE_RADIUS / 5;
int distance = fifthRadius + rand.nextInt(fifthRadius * 4);
double radians = Math.toRadians(rand.nextDouble() * 360);
int x = (int) (distance * Math.cos(radians));
int z = (int) (distance * Math.sin(radians));
BlockPos out = new BlockPos(around.getX() + x, around.getY(), around.getZ() + z);
return out;
}
示例5: updateTick
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
boolean flag = this.shouldBeOff(worldIn, pos, state);
List<BlockRedstoneTorch.Toggle> list = (List)toggles.get(worldIn);
while (list != null && !list.isEmpty() && worldIn.getTotalWorldTime() - ((BlockRedstoneTorch.Toggle)list.get(0)).time > 60L)
{
list.remove(0);
}
if (this.isOn)
{
if (flag)
{
worldIn.setBlockState(pos, Blocks.UNLIT_REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
if (this.isBurnedOut(worldIn, pos, true))
{
worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_REDSTONE_TORCH_BURNOUT, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);
for (int i = 0; i < 5; ++i)
{
double d0 = (double)pos.getX() + rand.nextDouble() * 0.6D + 0.2D;
double d1 = (double)pos.getY() + rand.nextDouble() * 0.6D + 0.2D;
double d2 = (double)pos.getZ() + rand.nextDouble() * 0.6D + 0.2D;
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
worldIn.scheduleUpdate(pos, worldIn.getBlockState(pos).getBlock(), 160);
}
}
}
else if (!flag && !this.isBurnedOut(worldIn, pos, false))
{
worldIn.setBlockState(pos, Blocks.REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
}
}
示例6: getBiome
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public Biome getBiome(BlockPos pos)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;
return this.chunkArray[i][j].getBiome(pos, this.worldObj.getBiomeProvider());
}
示例7: drop
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private static void drop(World world, BlockPos pos, BlockPos newPos) {
EntityFallingBlock fallingBlock = new EntityFallingBlock(world, newPos.getX(), newPos.getY(), newPos.getZ(), world.getBlockState(pos));
fallingBlock.setEntityBoundingBox(new AxisAlignedBB(newPos.add(0, 0, 0), newPos.add(1, 1, 1)));
fallingBlock.fallTime = 1;
world.spawnEntityInWorld(fallingBlock);
world.setBlockState(pos, Blocks.AIR.getDefaultState());
}
示例8: SPacketSpawnObject
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public SPacketSpawnObject(Entity entityIn, int typeIn, int dataIn, BlockPos pos)
{
this(entityIn, typeIn, dataIn);
this.x = (double)pos.getX();
this.y = (double)pos.getY();
this.z = (double)pos.getZ();
}
示例9: getGroundAboveSeaLevel
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public IBlockState getGroundAboveSeaLevel(BlockPos pos)
{
BlockPos blockpos;
for (blockpos = new BlockPos(pos.getX(), this.getSeaLevel(), pos.getZ()); !this.isAirBlock(blockpos.up()); blockpos = blockpos.up())
{
;
}
return this.getBlockState(blockpos);
}
示例10: breakBlock
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
*/
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
int i = 1;
int j = 2;
int k = pos.getX();
int l = pos.getY();
int i1 = pos.getZ();
if (worldIn.isAreaLoaded(new BlockPos(k - 2, l - 2, i1 - 2), new BlockPos(k + 2, l + 2, i1 + 2)))
{
for (int j1 = -1; j1 <= 1; ++j1)
{
for (int k1 = -1; k1 <= 1; ++k1)
{
for (int l1 = -1; l1 <= 1; ++l1)
{
BlockPos blockpos = pos.add(j1, k1, l1);
IBlockState iblockstate = worldIn.getBlockState(blockpos);
if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos))
{
iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos);
}
}
}
}
}
}
示例11: checkFallable
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private void checkFallable(World worldIn, BlockPos pos)
{
if ((worldIn.isAirBlock(pos.down()) || canFallThrough(worldIn.getBlockState(pos.down()))) && pos.getY() >= 0)
{
int i = 32;
if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-32, -32, -32), pos.add(32, 32, 32)))
{
if (!worldIn.isRemote)
{
EntityFallingBlock entityfallingblock = new EntityFallingBlock(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, worldIn.getBlockState(pos));
this.onStartFalling(entityfallingblock);
worldIn.spawnEntityInWorld(entityfallingblock);
}
}
else
{
IBlockState state = worldIn.getBlockState(pos);
worldIn.setBlockToAir(pos);
BlockPos blockpos;
for (blockpos = pos.down(); (worldIn.isAirBlock(blockpos) || canFallThrough(worldIn.getBlockState(blockpos))) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (blockpos.getY() > 0)
{
worldIn.setBlockState(blockpos.up(), state); //Forge: Fix loss of state information during world gen.
}
}
}
}
示例12: randomDisplayTick
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 1.5D;
double d2 = (double)pos.getZ() + 0.5D;
if(worldIn.getTileEntity(pos) instanceof TileEntityRange)
{
if(((TileEntityRange)worldIn.getTileEntity(pos)).isFueled())
{
EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING);
switch (enumfacing) {
case NORTH:
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+0.3, d1, d2+0.3, 0.0D, 0.0D, 0.0D, new int[0]);
break;
case WEST:
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+0.3, d1, d2-0.3, 0.0D, 0.0D, 0.0D, new int[0]);
break;
case SOUTH:
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0-0.3, d1, d2-0.3, 0.0D, 0.0D, 0.0D, new int[0]);
break;
case EAST:
worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0-0.3, d1, d2+0.3, 0.0D, 0.0D, 0.0D, new int[0]);
break;
default:
break;
}
}
}
}
示例13: addBlockHitEffects
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
/**
* Adds block hit particles for the specified block
*/
public void addBlockHitEffects(BlockPos pos, EnumFacing side)
{
IBlockState iblockstate = this.worldObj.getBlockState(pos);
if (iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
float f = 0.1F;
AxisAlignedBB axisalignedbb = iblockstate.getBoundingBox(this.worldObj, pos);
double d0 = (double)i + this.rand.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minX;
double d1 = (double)j + this.rand.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minY;
double d2 = (double)k + this.rand.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minZ;
if (side == EnumFacing.DOWN)
{
d1 = (double)j + axisalignedbb.minY - 0.10000000149011612D;
}
if (side == EnumFacing.UP)
{
d1 = (double)j + axisalignedbb.maxY + 0.10000000149011612D;
}
if (side == EnumFacing.NORTH)
{
d2 = (double)k + axisalignedbb.minZ - 0.10000000149011612D;
}
if (side == EnumFacing.SOUTH)
{
d2 = (double)k + axisalignedbb.maxZ + 0.10000000149011612D;
}
if (side == EnumFacing.WEST)
{
d0 = (double)i + axisalignedbb.minX - 0.10000000149011612D;
}
if (side == EnumFacing.EAST)
{
d0 = (double)i + axisalignedbb.maxX + 0.10000000149011612D;
}
this.addEffect((new ParticleDigging(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
}
示例14: PositionedSoundRecord
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
public PositionedSoundRecord(SoundEvent soundIn, SoundCategory categoryIn, float volumeIn, float pitchIn, BlockPos pos)
{
this(soundIn, categoryIn, volumeIn, pitchIn, (float)pos.getX() + 0.5F, (float)pos.getY() + 0.5F, (float)pos.getZ() + 0.5F);
}
示例15: generateNormal
import net.minecraft.util.math.BlockPos; //导入方法依赖的package包/类
private boolean generateNormal(World worldIn, Random rand, BlockPos position) {
int i = rand.nextInt(3) + 5;
boolean flag = true;
if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
flag = isAreaClear(worldIn, position, i);
if (!flag) {
return false;
} else {
IBlockState state = worldIn.getBlockState(position.down());
if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) net.minecraft.init.Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
this.setDirtAt(worldIn, position.down());
for (int i3 = position.getY() - 3 + i; i3 <= position.getY() + i; ++i3) {
int i4 = i3 - (position.getY() + i);
int j1 = 1 - i4 / 2;
for (int k1 = position.getX() - j1; k1 <= position.getX() + j1; ++k1) {
int l1 = k1 - position.getX();
for (int i2 = position.getZ() - j1; i2 <= position.getZ() + j1; ++i2) {
int j2 = i2 - position.getZ();
if (Math.abs(l1) != j1 || Math.abs(j2) != j1 || rand.nextInt(2) != 0 && i4 != 0) {
BlockPos blockpos = new BlockPos(k1, i3, i2);
state = worldIn.getBlockState(blockpos);
if (state.getBlock().isAir(state, worldIn, blockpos) || state.getBlock().isLeaves(state, worldIn, blockpos) || state.getMaterial() == Material.VINE) {
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.metaLeaves);
}
}
}
}
}
for (int j3 = 0; j3 < i; ++j3) {
BlockPos upN = position.up(j3);
state = worldIn.getBlockState(upN);
if (state.getBlock().isAir(state, worldIn, upN) || state.getBlock().isLeaves(state, worldIn, upN) || state.getMaterial() == Material.VINE) {
this.setBlockAndNotifyAdequately(worldIn, position.up(j3), this.metaWood);
}
}
return true;
} else {
return false;
}
}
} else {
return false;
}
}