Does the second part of the explosion (sound, particles, drop spawn)
(boolean spawnParticles)
| 172 | * Does the second part of the explosion (sound, particles, drop spawn) |
| 173 | */ |
| 174 | public void doExplosionB(boolean spawnParticles) |
| 175 | { |
| 176 | this.worldObj.playSoundEffect(this.explosionX, this.explosionY, this.explosionZ, "random.explode", 4.0F, (1.0F + (this.worldObj.rand.nextFloat() - this.worldObj.rand.nextFloat()) * 0.2F) * 0.7F); |
| 177 | |
| 178 | if (this.explosionSize >= 2.0F && this.isSmoking) |
| 179 | { |
| 180 | this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D, new int[0]); |
| 181 | } |
| 182 | else |
| 183 | { |
| 184 | this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.explosionX, this.explosionY, this.explosionZ, 1.0D, 0.0D, 0.0D, new int[0]); |
| 185 | } |
| 186 | |
| 187 | if (this.isSmoking) |
| 188 | { |
| 189 | for (BlockPos blockpos : this.affectedBlockPositions) |
| 190 | { |
| 191 | Block block = this.worldObj.getBlockState(blockpos).getBlock(); |
| 192 | |
| 193 | if (spawnParticles) |
| 194 | { |
| 195 | double d0 = (float)blockpos.getX() + this.worldObj.rand.nextFloat(); |
| 196 | double d1 = (float)blockpos.getY() + this.worldObj.rand.nextFloat(); |
| 197 | double d2 = (float)blockpos.getZ() + this.worldObj.rand.nextFloat(); |
| 198 | double d3 = d0 - this.explosionX; |
| 199 | double d4 = d1 - this.explosionY; |
| 200 | double d5 = d2 - this.explosionZ; |
| 201 | double d6 = MathHelper.sqrt_double(d3 * d3 + d4 * d4 + d5 * d5); |
| 202 | d3 = d3 / d6; |
| 203 | d4 = d4 / d6; |
| 204 | d5 = d5 / d6; |
| 205 | double d7 = 0.5D / (d6 / (double)this.explosionSize + 0.1D); |
| 206 | d7 = d7 * (double)(this.worldObj.rand.nextFloat() * this.worldObj.rand.nextFloat() + 0.3F); |
| 207 | d3 = d3 * d7; |
| 208 | d4 = d4 * d7; |
| 209 | d5 = d5 * d7; |
| 210 | this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, (d0 + this.explosionX) / 2.0D, (d1 + this.explosionY) / 2.0D, (d2 + this.explosionZ) / 2.0D, d3, d4, d5, new int[0]); |
| 211 | this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]); |
| 212 | } |
| 213 | |
| 214 | if (block.getMaterial() != Material.air) |
| 215 | { |
| 216 | if (block.canDropFromExplosion(this)) |
| 217 | { |
| 218 | block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getBlockState(blockpos), 1.0F / this.explosionSize, 0); |
| 219 | } |
| 220 | |
| 221 | this.worldObj.setBlockState(blockpos, Blocks.air.getDefaultState(), 3); |
| 222 | block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this); |
| 223 | } |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | if (this.isFlaming) |
| 228 | { |
| 229 | for (BlockPos blockpos1 : this.affectedBlockPositions) |
| 230 | { |
| 231 | if (this.worldObj.getBlockState(blockpos1).getBlock().getMaterial() == Material.air && this.worldObj.getBlockState(blockpos1.down()).getBlock().isFullBlock() && this.explosionRNG.nextInt(3) == 0) |
no test coverage detected