MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / doExplosionB

Method doExplosionB

src/main/java/net/minecraft/world/Explosion.java:174–237  ·  view source on GitHub ↗

Does the second part of the explosion (sound, particles, drop spawn)

(boolean spawnParticles)

Source from the content-addressed store, hash-verified

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)

Callers 3

handleExplosionMethod · 0.95
newExplosionMethod · 0.95
newExplosionMethod · 0.95

Calls 15

sqrt_doubleMethod · 0.95
getMaterialMethod · 0.95
canDropFromExplosionMethod · 0.95
playSoundEffectMethod · 0.80
getDefaultStateMethod · 0.80
downMethod · 0.80
nextIntMethod · 0.80
spawnParticleMethod · 0.65
getBlockMethod · 0.65
getBlockStateMethod · 0.65

Tested by

no test coverage detected