本文整理匯總了Java中net.minecraft.util.BlockPos.down方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockPos.down方法的具體用法?Java BlockPos.down怎麽用?Java BlockPos.down使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.BlockPos
的用法示例。
在下文中一共展示了BlockPos.down方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generate
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
Block block;
while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
{
position = position.down();
}
for (int i = 0; i < 128; ++i)
{
BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));
if (worldIn.isAirBlock(blockpos) && Blocks.tallgrass.canBlockStay(worldIn, blockpos, this.tallGrassState))
{
worldIn.setBlockState(blockpos, this.tallGrassState, 2);
}
}
return true;
}
示例2: onBlockActivated
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (this.blockMaterial == Material.iron)
{
return true;
}
else
{
BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos);
if (iblockstate.getBlock() != this)
{
return false;
}
else
{
state = iblockstate.cycleProperty(OPEN);
worldIn.setBlockState(blockpos, state, 2);
worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
return true;
}
}
}
示例3: getTopSolidOrLiquidBlock
import net.minecraft.util.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();
Material material = chunk.getBlock(blockpos1).getMaterial();
if (material.blocksMovement() && material != Material.leaves)
{
break;
}
}
return blockpos;
}
示例4: func_111098_b
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean func_111098_b(World worldIn)
{
BlockPos blockpos = new BlockPos(this.field_111101_a, 256.0D, this.field_111100_b);
while (blockpos.getY() > 0)
{
blockpos = blockpos.down();
Material material = worldIn.getBlockState(blockpos).getBlock().getMaterial();
if (material != Material.air)
{
return !material.isLiquid() && material != Material.fire;
}
}
return false;
}
示例5: toggleDoor
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public void toggleDoor(World worldIn, BlockPos pos, boolean open)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this)
{
BlockPos blockpos = iblockstate.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
IBlockState iblockstate1 = pos == blockpos ? iblockstate : worldIn.getBlockState(blockpos);
if (iblockstate1.getBlock() == this && ((Boolean)iblockstate1.getValue(OPEN)).booleanValue() != open)
{
worldIn.setBlockState(blockpos, iblockstate1.withProperty(OPEN, Boolean.valueOf(open)), 2);
worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
worldIn.playAuxSFXAtEntity((EntityPlayer)null, open ? 1003 : 1006, pos, 0);
}
}
}
示例6: func_181647_a
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private void func_181647_a(World p_181647_1_, BlockPos p_181647_2_, PropertyBool p_181647_3_)
{
IBlockState iblockstate = Blocks.vine.getDefaultState().withProperty(p_181647_3_, Boolean.valueOf(true));
this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate);
int i = 4;
for (p_181647_2_ = p_181647_2_.down(); p_181647_1_.getBlockState(p_181647_2_).getBlock().getMaterial() == Material.air && i > 0; --i)
{
this.setBlockAndNotifyAdequately(p_181647_1_, p_181647_2_, iblockstate);
p_181647_2_ = p_181647_2_.down();
}
}
示例7: generate
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
for (int i = 0; i < 20; ++i)
{
BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), 0, rand.nextInt(4) - rand.nextInt(4));
if (worldIn.isAirBlock(blockpos))
{
BlockPos blockpos1 = blockpos.down();
if (worldIn.getBlockState(blockpos1.west()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.east()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.north()).getBlock().getMaterial() == Material.water || worldIn.getBlockState(blockpos1.south()).getBlock().getMaterial() == Material.water)
{
int j = 2 + rand.nextInt(rand.nextInt(3) + 1);
for (int k = 0; k < j; ++k)
{
if (Blocks.reeds.canBlockStay(worldIn, blockpos))
{
worldIn.setBlockState(blockpos.up(k), Blocks.reeds.getDefaultState(), 2);
}
}
}
}
}
return true;
}
示例8: checkFall
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private void checkFall(World worldIn, BlockPos pos)
{
if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
{
int i = 32;
if (!BlockFalling.fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
{
worldIn.spawnEntityInWorld(new EntityFallingBlock(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), this.getDefaultState()));
}
else
{
worldIn.setBlockToAir(pos);
BlockPos blockpos;
for (blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (blockpos.getY() > 0)
{
worldIn.setBlockState(blockpos, this.getDefaultState(), 2);
}
}
}
}
示例9: checkFallable
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
private void checkFallable(World worldIn, BlockPos pos)
{
if (canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
{
int i = 32;
if (!fallInstantly && worldIn.isAreaLoaded(pos.add(-i, -i, -i), pos.add(i, i, i)))
{
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
{
worldIn.setBlockToAir(pos);
BlockPos blockpos;
for (blockpos = pos.down(); canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
if (blockpos.getY() > 0)
{
worldIn.setBlockState(blockpos.up(), this.getDefaultState());
}
}
}
}
示例10: Size
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public Size(World worldIn, BlockPos p_i45694_2_, EnumFacing.Axis p_i45694_3_)
{
this.world = worldIn;
this.axis = p_i45694_3_;
if (p_i45694_3_ == EnumFacing.Axis.X)
{
this.field_150863_d = EnumFacing.EAST;
this.field_150866_c = EnumFacing.WEST;
}
else
{
this.field_150863_d = EnumFacing.NORTH;
this.field_150866_c = EnumFacing.SOUTH;
}
for (BlockPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getBlockState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down())
{
;
}
int i = this.func_180120_a(p_i45694_2_, this.field_150863_d) - 1;
if (i >= 0)
{
this.field_150861_f = p_i45694_2_.offset(this.field_150863_d, i);
this.field_150868_h = this.func_180120_a(this.field_150861_f, this.field_150866_c);
if (this.field_150868_h < 2 || this.field_150868_h > 21)
{
this.field_150861_f = null;
this.field_150868_h = 0;
}
}
if (this.field_150861_f != null)
{
this.field_150862_g = this.func_150858_a();
}
}
示例11: canBlockSeeSky
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean canBlockSeeSky(BlockPos pos)
{
if (pos.getY() >= this.func_181545_F())
{
return this.canSeeSky(pos);
}
else
{
BlockPos blockpos = new BlockPos(pos.getX(), this.func_181545_F(), pos.getZ());
if (!this.canSeeSky(blockpos))
{
return false;
}
else
{
for (blockpos = blockpos.down(); blockpos.getY() > pos.getY(); blockpos = blockpos.down())
{
Block block = this.getBlockState(blockpos).getBlock();
if (block.getLightOpacity() > 0 && !block.getMaterial().isLiquid())
{
return false;
}
}
return true;
}
}
}
示例12: teleportTo
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
/**
* Teleport the enderman
*/
protected boolean teleportTo(double x, double y, double z)
{
double d0 = this.posX;
double d1 = this.posY;
double d2 = this.posZ;
this.posX = x;
this.posY = y;
this.posZ = z;
boolean flag = false;
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
if (this.worldObj.isBlockLoaded(blockpos))
{
boolean flag1 = false;
while (!flag1 && blockpos.getY() > 0)
{
BlockPos blockpos1 = blockpos.down();
Block block = this.worldObj.getBlockState(blockpos1).getBlock();
if (block.getMaterial().blocksMovement())
{
flag1 = true;
}
else
{
--this.posY;
blockpos = blockpos1;
}
}
if (flag1)
{
super.setPositionAndUpdate(this.posX, this.posY, this.posZ);
if (this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.isAnyLiquid(this.getEntityBoundingBox()))
{
flag = true;
}
}
}
if (!flag)
{
this.setPosition(d0, d1, d2);
return false;
}
else
{
int i = 128;
for (int j = 0; j < i; ++j)
{
double d6 = (double)j / ((double)i - 1.0D);
float f = (this.rand.nextFloat() - 0.5F) * 0.2F;
float f1 = (this.rand.nextFloat() - 0.5F) * 0.2F;
float f2 = (this.rand.nextFloat() - 0.5F) * 0.2F;
double d3 = d0 + (this.posX - d0) * d6 + (this.rand.nextDouble() - 0.5D) * (double)this.width * 2.0D;
double d4 = d1 + (this.posY - d1) * d6 + this.rand.nextDouble() * (double)this.height;
double d5 = d2 + (this.posZ - d2) * d6 + (this.rand.nextDouble() - 0.5D) * (double)this.width * 2.0D;
this.worldObj.spawnParticle(EnumParticleTypes.PORTAL, d3, d4, d5, (double)f, (double)f1, (double)f2, new int[0]);
}
this.worldObj.playSoundEffect(d0, d1, d2, "mob.endermen.portal", 1.0F, 1.0F);
this.playSound("mob.endermen.portal", 1.0F, 1.0F);
return true;
}
}
示例13: generate
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
Block block;
while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
{
position = position.down();
}
Block block1 = worldIn.getBlockState(position).getBlock();
if (block1 == Blocks.dirt || block1 == Blocks.grass)
{
position = position.up();
this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata);
for (int i = position.getY(); i <= position.getY() + 2; ++i)
{
int j = i - position.getY();
int k = 2 - j;
for (int l = position.getX() - k; l <= position.getX() + k; ++l)
{
int i1 = l - position.getX();
for (int j1 = position.getZ() - k; j1 <= position.getZ() + k; ++j1)
{
int k1 = j1 - position.getZ();
if (Math.abs(i1) != k || Math.abs(k1) != k || rand.nextInt(2) != 0)
{
BlockPos blockpos = new BlockPos(l, i, j1);
if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock())
{
this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
}
}
}
}
}
}
return true;
}
示例14: generate
import net.minecraft.util.BlockPos; //導入方法依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
Block block;
while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 1)
{
position = position.down();
}
if (position.getY() < 1)
{
return false;
}
else
{
position = position.up();
for (int i = 0; i < 4; ++i)
{
BlockPos blockpos = position.add(rand.nextInt(4) - rand.nextInt(4), rand.nextInt(3) - rand.nextInt(3), rand.nextInt(4) - rand.nextInt(4));
if (worldIn.isAirBlock(blockpos) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos.down()))
{
worldIn.setBlockState(blockpos, Blocks.chest.getDefaultState(), 2);
TileEntity tileentity = worldIn.getTileEntity(blockpos);
if (tileentity instanceof TileEntityChest)
{
WeightedRandomChestContent.generateChestContents(rand, this.chestItems, (TileEntityChest)tileentity, this.itemsToGenerateInBonusChest);
}
BlockPos blockpos1 = blockpos.east();
BlockPos blockpos2 = blockpos.west();
BlockPos blockpos3 = blockpos.north();
BlockPos blockpos4 = blockpos.south();
if (worldIn.isAirBlock(blockpos2) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos2.down()))
{
worldIn.setBlockState(blockpos2, Blocks.torch.getDefaultState(), 2);
}
if (worldIn.isAirBlock(blockpos1) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos1.down()))
{
worldIn.setBlockState(blockpos1, Blocks.torch.getDefaultState(), 2);
}
if (worldIn.isAirBlock(blockpos3) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos3.down()))
{
worldIn.setBlockState(blockpos3, Blocks.torch.getDefaultState(), 2);
}
if (worldIn.isAirBlock(blockpos4) && World.doesBlockHaveSolidTopSurface(worldIn, blockpos4.down()))
{
worldIn.setBlockState(blockpos4, Blocks.torch.getDefaultState(), 2);
}
return true;
}
}
return false;
}
}