本文整理汇总了Java中net.minecraft.block.Block.canEntityDestroy方法的典型用法代码示例。如果您正苦于以下问题:Java Block.canEntityDestroy方法的具体用法?Java Block.canEntityDestroy怎么用?Java Block.canEntityDestroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.canEntityDestroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: breakBlocks
import net.minecraft.block.Block; //导入方法依赖的package包/类
public boolean breakBlocks(){
boolean flag = false;
AxisAlignedBB box=this.getBreakingBB();
for (int x = MathHelper.floor(box.minX); x <= MathHelper.floor(box.maxX); ++x)
for (int y = MathHelper.floor(box.minY); y <= MathHelper.floor(box.maxY); ++y)
for (int z = MathHelper.floor(box.minZ); z <= MathHelper.floor(box.maxZ); ++z) {
BlockPos blockpos = new BlockPos(x, y, z);
IBlockState iblockstate = this.world.getBlockState(blockpos);
Block block = iblockstate.getBlock();
if (!block.isAir(iblockstate, this.world, blockpos) && !iblockstate.getMaterial().isLiquid()
&& EntityWither.canDestroyBlock(block)
&& block.canEntityDestroy(iblockstate, world, blockpos, this))
flag = this.world.destroyBlock(blockpos, true) || flag;
}
if (flag)
this.world.playEvent((EntityPlayer) null, 1022, new BlockPos(this), 0);
return flag;
}
示例2: getExplosionResistance
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Explosion resistance of a block relative to this entity
*/
public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, IBlockState blockStateIn)
{
float f = super.getExplosionResistance(explosionIn, worldIn, pos, blockStateIn);
Block block = blockStateIn.getBlock();
if (this.isInvulnerable() && block.canEntityDestroy(blockStateIn, worldIn, pos, this))
{
f = Math.min(0.8F, f);
}
return f;
}
示例3: destroyBlocksInAABB
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Destroys all blocks that aren't associated with 'The End' inside the given bounding box.
*/
private boolean destroyBlocksInAABB(AxisAlignedBB p_70972_1_)
{
int i = MathHelper.floor_double(p_70972_1_.minX);
int j = MathHelper.floor_double(p_70972_1_.minY);
int k = MathHelper.floor_double(p_70972_1_.minZ);
int l = MathHelper.floor_double(p_70972_1_.maxX);
int i1 = MathHelper.floor_double(p_70972_1_.maxY);
int j1 = MathHelper.floor_double(p_70972_1_.maxZ);
boolean flag = false;
boolean flag1 = false;
for (int k1 = i; k1 <= l; ++k1)
{
for (int l1 = j; l1 <= i1; ++l1)
{
for (int i2 = k; i2 <= j1; ++i2)
{
BlockPos blockpos = new BlockPos(k1, l1, i2);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
Block block = iblockstate.getBlock();
if (!block.isAir(iblockstate, this.worldObj, blockpos) && iblockstate.getMaterial() != Material.FIRE)
{
if (!this.worldObj.getGameRules().getBoolean("mobGriefing"))
{
flag = true;
}
else if (block.canEntityDestroy(iblockstate, this.worldObj, blockpos, this))
{
if (block != Blocks.COMMAND_BLOCK && block != Blocks.REPEATING_COMMAND_BLOCK && block != Blocks.CHAIN_COMMAND_BLOCK && block != Blocks.IRON_BARS && block != Blocks.END_GATEWAY)
{
flag1 = this.worldObj.setBlockToAir(blockpos) || flag1;
}
else
{
flag = true;
}
}
else
{
flag = true;
}
}
}
}
}
if (flag1)
{
double d0 = p_70972_1_.minX + (p_70972_1_.maxX - p_70972_1_.minX) * (double)this.rand.nextFloat();
double d1 = p_70972_1_.minY + (p_70972_1_.maxY - p_70972_1_.minY) * (double)this.rand.nextFloat();
double d2 = p_70972_1_.minZ + (p_70972_1_.maxZ - p_70972_1_.minZ) * (double)this.rand.nextFloat();
this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
return flag;
}