public void a(boolean flag) { this.world.makeSound( this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F); if (this.size >= 2.0F && this.b) { this.world.addParticle("hugeexplosion", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D); } else { this.world.addParticle("largeexplode", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D); } Iterator iterator; ChunkPosition chunkposition; int i; int j; int k; int l; if (this.b) { // CraftBukkit start org.bukkit.World bworld = this.world.getWorld(); org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity(); Location location = new Location(bworld, this.posX, this.posY, this.posZ); List<org.bukkit.block.Block> blockList = new ArrayList<org.bukkit.block.Block>(); for (int i1 = this.blocks.size() - 1; i1 >= 0; i1--) { ChunkPosition cpos = (ChunkPosition) this.blocks.get(i1); org.bukkit.block.Block block = bworld.getBlockAt(cpos.x, cpos.y, cpos.z); if (block.getType() != org.bukkit.Material.AIR) { blockList.add(block); } } EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, 0.3F); this.world.getServer().getPluginManager().callEvent(event); this.blocks.clear(); for (org.bukkit.block.Block block : event.blockList()) { ChunkPosition coords = new ChunkPosition(block.getX(), block.getY(), block.getZ()); blocks.add(coords); } if (event.isCancelled()) { this.wasCanceled = true; return; } // CraftBukkit end iterator = this.blocks.iterator(); while (iterator.hasNext()) { chunkposition = (ChunkPosition) iterator.next(); i = chunkposition.x; j = chunkposition.y; k = chunkposition.z; l = this.world.getTypeId(i, j, k); if (flag) { double d0 = (double) ((float) i + this.world.random.nextFloat()); double d1 = (double) ((float) j + this.world.random.nextFloat()); double d2 = (double) ((float) k + this.world.random.nextFloat()); double d3 = d0 - this.posX; double d4 = d1 - this.posY; double d5 = d2 - this.posZ; double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5); d3 /= d6; d4 /= d6; d5 /= d6; double d7 = 0.5D / (d6 / (double) this.size + 0.1D); d7 *= (double) (this.world.random.nextFloat() * this.world.random.nextFloat() + 0.3F); d3 *= d7; d4 *= d7; d5 *= d7; this.world.addParticle( "explode", (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D, (d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5); this.world.addParticle("smoke", d0, d1, d2, d3, d4, d5); } if (l > 0) { Block block = Block.byId[l]; if (block.a(this)) { // CraftBukkit - add yield block.dropNaturally( this.world, i, j, k, this.world.getData(i, j, k), event.getYield(), 0); } this.world.setTypeIdAndData(i, j, k, 0, 0, 3); block.wasExploded(this.world, i, j, k, this); } } } if (this.a) { iterator = this.blocks.iterator(); while (iterator.hasNext()) { chunkposition = (ChunkPosition) iterator.next(); i = chunkposition.x; j = chunkposition.y; k = chunkposition.z; l = this.world.getTypeId(i, j, k); int i1 = this.world.getTypeId(i, j - 1, k); if (l == 0 && Block.t[i1] && this.j.nextInt(3) == 0) { // CraftBukkit start - Ignition by explosion if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent( this.world, i, j, k, this) .isCancelled()) { this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id); } // CraftBukkit end } } } }
public void a(boolean flag) { this.world.makeSound( this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F); if (this.size >= 2.0F && this.b) { this.world.addParticle( EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]); } else { this.world.addParticle( EnumParticle.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]); } Iterator iterator; BlockPosition blockposition; if (this.b) { // CraftBukkit start org.bukkit.World bworld = this.world.getWorld(); org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity(); Location location = new Location(bworld, this.posX, this.posY, this.posZ); List<org.bukkit.block.Block> blockList = Lists.newArrayList(); for (int i1 = this.blocks.size() - 1; i1 >= 0; i1--) { BlockPosition cpos = (BlockPosition) this.blocks.get(i1); org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ()); if (bblock.getType() != org.bukkit.Material.AIR) { blockList.add(bblock); } } boolean cancelled; List<org.bukkit.block.Block> bukkitBlocks; float yield; if (explode != null) { EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, 0.3F); this.world.getServer().getPluginManager().callEvent(event); cancelled = event.isCancelled(); bukkitBlocks = event.blockList(); yield = event.getYield(); } else { BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, 0.3F); this.world.getServer().getPluginManager().callEvent(event); cancelled = event.isCancelled(); bukkitBlocks = event.blockList(); yield = event.getYield(); } this.blocks.clear(); for (org.bukkit.block.Block bblock : bukkitBlocks) { BlockPosition coords = new BlockPosition(bblock.getX(), bblock.getY(), bblock.getZ()); blocks.add(coords); } if (cancelled) { this.wasCanceled = true; return; } // CraftBukkit end iterator = this.blocks.iterator(); while (iterator.hasNext()) { blockposition = (BlockPosition) iterator.next(); Block block = this.world.getType(blockposition).getBlock(); world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot if (flag) { double d0 = (double) ((float) blockposition.getX() + this.world.random.nextFloat()); double d1 = (double) ((float) blockposition.getY() + this.world.random.nextFloat()); double d2 = (double) ((float) blockposition.getZ() + this.world.random.nextFloat()); double d3 = d0 - this.posX; double d4 = d1 - this.posY; double d5 = d2 - this.posZ; double d6 = (double) MathHelper.sqrt(d3 * d3 + d4 * d4 + d5 * d5); d3 /= d6; d4 /= d6; d5 /= d6; double d7 = 0.5D / (d6 / (double) this.size + 0.1D); d7 *= (double) (this.world.random.nextFloat() * this.world.random.nextFloat() + 0.3F); d3 *= d7; d4 *= d7; d5 *= d7; this.world.addParticle( EnumParticle.EXPLOSION_NORMAL, (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D, (d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5, new int[0]); this.world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]); } if (block.getMaterial() != Material.AIR) { if (block.a(this)) { // CraftBukkit - add yield block.dropNaturally( this.world, blockposition, this.world.getType(blockposition), yield, 0); } this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); block.wasExploded(this.world, blockposition, this); } } } if (this.a) { iterator = this.blocks.iterator(); while (iterator.hasNext()) { blockposition = (BlockPosition) iterator.next(); if (this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && this.world.getType(blockposition.down()).getBlock().o() && this.c.nextInt(3) == 0) { // CraftBukkit start - Ignition by explosion if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent( this.world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this) .isCancelled()) { this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); } // CraftBukkit end } } } }