net.minecraft.block.Block.onBlockExploded()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中net.minecraft.block.Block.onBlockExploded()方法的一些代码示例,展示了Block.onBlockExploded()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.onBlockExploded()方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:onBlockExploded

Block.onBlockExploded介绍

暂无

代码示例

代码示例来源:origin: SlimeKnights/TinkersConstruct

private void explodeBlock(BlockPos pos) {
  IBlockState state = world.getBlockState(pos);
  Block block = state.getBlock();
  if(!world.isRemote && block.canDropFromExplosion(explosion)) {
   List<ItemStack> drops = block.getDrops(world, pos, state, 0);
   ForgeEventFactory.fireBlockHarvesting(drops, world, pos, state, 0, 1f, false, null);
   droppedItems.addAll(drops);
  }

  if(world instanceof WorldServer) {
   ((WorldServer) world).spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, true, pos.getX(), pos.getY(), pos.getZ(), 2, 0, 0, 0, 0d);
   ((WorldServer) world).spawnParticle(EnumParticleTypes.SMOKE_LARGE, true, pos.getX(), pos.getY(), pos.getZ(), 1, 0, 0, 0, 0d);
  }

  block.onBlockExploded(world, pos, explosion);
 }
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

block.onBlockExploded(this.world, blockpos, this);

代码示例来源:origin: amadornes/MCMultiPart

@Override
public void onBlockExploded(World world, BlockPos pos, Explosion explosion) {
  // TODO: This is where we remove the parts. We can do fun stuff here!
  super.onBlockExploded(world, pos, explosion);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

block.onBlockExploded( this.world, point, ex );

代码示例来源:origin: Darkhax-Minecraft/Bookshelf

public void destroyBlock (Block block, IBlockState state, BlockPos pos) {
  
  if (this.doesDestroyBlocks()) {
    
    if (block.canDropFromExplosion(this)) {
      
      block.dropBlockAsItemWithChance(this.world, pos, this.world.getBlockState(pos), 1.0F / this.size, 0);
    }
    
    block.onBlockExploded(this.world, pos, this);
  }
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0);
block.onBlockExploded(this.worldObj, blockpos, this);

代码示例来源:origin: McJtyMods/DeepResonance

private static void explodeHelper(World world, BlockPos location, float radius) {
  Explosion boom = new Explosion(world, null, location.getX(), location.getY(), location.getZ(), radius, false, true);
  for(int x = (int)(-radius); x < radius; ++x) {
    for(int y = (int)(-radius); y < radius; ++y) {
      for(int z = (int)(-radius); z < radius; ++z) {
        BlockPos targetPosition = location.add(x, y, z);
        double dist = Math.sqrt(location.distanceSq(targetPosition));
        if(dist < radius) {
          Block block = world.getBlockState(targetPosition).getBlock();
          IBlockState state = world.getBlockState(targetPosition);
          if(block != null && !block.isAir(state, world, targetPosition) && block.getBlockHardness(state, world, targetPosition) > 0 && (dist < (radius - 1.0F) || world.rand.nextFloat() > 0.7D)) {
            block.onBlockExploded(world, targetPosition, boom);
          }
        }
      }
    }
  }
}

代码示例来源:origin: sinkillerj/ProjectE

block.onBlockExploded(worldObj, blockpos, this);

代码示例来源:origin: PrinceOfAmber/Cyclic

block.onBlockExploded(this.world, blockpos, this);

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

block.onBlockExploded(this.worldObj, blockpos, this);

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

block.onBlockExploded(this.worldObj, blockpos, this);

代码示例来源:origin: Alex-the-666/Ice_and_Fire

block.onBlockExploded(this.worldObj, blockpos, this);

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

block.dropBlockAsItemWithChance(ship.world, pos, state, 1.0F / expl.size, 0);
block.onBlockExploded(ship.world, pos, expl);
if (!worldIn.isRemote) {
  Vector posVector = new Vector(pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5);

相关文章

Block类方法