2021-03-16 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								--- a/net/minecraft/world/level/Explosion.java
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+++ b/net/minecraft/world/level/Explosion.java
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -40,6 +40,15 @@
							 | 
						
					
						
							
								
									
										
										
										
											2021-03-16 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 import net.minecraft.world.phys.MovingObjectPosition;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 import net.minecraft.world.phys.Vec3D;
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-26 22:41:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+// CraftBukkit start
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-03 18:07:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+import net.minecraft.world.entity.boss.EntityComplexPart;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.craftbukkit.event.CraftEventFactory;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.event.entity.EntityExplodeEvent;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.Location;
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-22 19:42:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+import org.bukkit.event.block.BlockExplodeEvent;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+// CraftBukkit end
							 | 
						
					
						
							
								
									
										
										
										
											2015-02-26 22:41:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 public class Explosion {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -58,6 +67,7 @@
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     private final ExplosionDamageCalculator damageCalculator;
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     private final ObjectArrayList<BlockPosition> toBlow;
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     private final Map<EntityHuman, Vec3D> hitPlayers;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+    public boolean wasCanceled = false; // CraftBukkit - add field
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-08 03:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     public Explosion(World world, @Nullable Entity entity, double d0, double d1, double d2, float f, List<BlockPosition> list) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this(world, entity, d0, d1, d2, f, false, Explosion.Effect.DESTROY_WITH_DECAY, list);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								@@ -78,7 +88,7 @@
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         this.hitPlayers = Maps.newHashMap();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.level = world;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.source = entity;
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-        this.radius = f;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        this.radius = (float) Math.max(f, 0.0); // CraftBukkit - clamp bad values
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.x = d0;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.y = d1;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         this.z = d2;
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-08 03:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -128,6 +138,11 @@
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								     }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     public void explode() {
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit start
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        if (this.radius < 0.1F) {
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+        // CraftBukkit end
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3D(this.x, this.y, this.z));
							 | 
						
					
						
							
								
									
										
										
										
											2018-12-26 08:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         Set<BlockPosition> set = Sets.newHashSet();
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         boolean flag = true;
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-27 20:34:19 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -211,7 +226,39 @@
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                         double d12 = (double) getSeenPercent(vec3d, entity);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                         double d13 = (1.0D - d7) * d12;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-                        entity.hurt(this.getDamageSource(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                        // CraftBukkit start
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-03 18:07:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        // Special case ender dragon only give knockback if no damage is cancelled
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        // Thinks to note:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        // - Setting a velocity to a ComplexEntityPart is ignored (and therefore not needed)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        // - Damaging ComplexEntityPart while forward the damage to EntityEnderDragon
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        // - Damaging EntityEnderDragon does nothing
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        // - EntityEnderDragon hitbock always covers the other parts and is therefore always present
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        if (entity instanceof EntityComplexPart) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                            continue;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-29 14:06:51 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                        CraftEventFactory.entityDamage = source;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        entity.lastDamageCancelled = false;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-03 18:07:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                        if (entity instanceof EntityEnderDragon) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                            for (EntityComplexPart entityComplexPart : ((EntityEnderDragon) entity).subEntities) {
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-27 20:34:19 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                                // Calculate damage separately for each EntityComplexPart
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                                double d7part;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                                if (list.contains(entityComplexPart) && (d7part = Math.sqrt(entityComplexPart.distanceToSqr(vec3d)) / f2) <= 1.0D) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                                    double d13part = (1.0D - d7part) * getSeenPercent(vec3d, entityComplexPart);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                                    entityComplexPart.hurt(this.getDamageSource(), (float) ((int) ((d13part * d13part + d13part) / 2.0D * 7.0D * (double) f2 + 1.0D)));
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-03 18:07:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        } else {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                            entity.hurt(this.getDamageSource(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        CraftEventFactory.entityDamage = null;
							 | 
						
					
						
							
								
									
										
										
										
											2022-01-03 18:07:01 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                        if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-25 10:45:02 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                            continue;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        }
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                        // CraftBukkit end
							 | 
						
					
						
							
								
									
										
										
										
											2016-11-17 12:41:03 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                         double d14 = d13;
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                         if (entity instanceof EntityLiving) {
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-27 20:34:19 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -254,6 +301,51 @@
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             SystemUtils.shuffle(this.toBlow, this.level.random);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             ObjectListIterator objectlistiterator = this.toBlow.iterator();
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            // CraftBukkit start
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            org.bukkit.World bworld = this.level.getWorld();
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity();
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            Location location = new Location(bworld, this.x, this.y, this.z);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            List<org.bukkit.block.Block> blockList = new ObjectArrayList<>();
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            for (int i1 = this.toBlow.size() - 1; i1 >= 0; i1--) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                BlockPosition cpos = (BlockPosition) this.toBlow.get(i1);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ());
							 | 
						
					
						
							
								
									
										
										
										
											2020-01-27 10:09:46 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                if (!bblock.getType().isAir()) {
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                    blockList.add(bblock);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-22 19:42:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            boolean cancelled;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            List<org.bukkit.block.Block> bukkitBlocks;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            float yield;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            if (explode != null) {
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-04 11:47:05 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F);
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 21:33:49 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                this.level.getCraftServer().getPluginManager().callEvent(event);
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-22 19:42:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                cancelled = event.isCancelled();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                bukkitBlocks = event.blockList();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                yield = event.getYield();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            } else {
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-04 11:47:05 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F);
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 21:33:49 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                this.level.getCraftServer().getPluginManager().callEvent(event);
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-22 19:42:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                cancelled = event.isCancelled();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                bukkitBlocks = event.blockList();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                yield = event.getYield();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            this.toBlow.clear();
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-22 19:42:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            for (org.bukkit.block.Block bblock : bukkitBlocks) {
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                BlockPosition coords = new BlockPosition(bblock.getX(), bblock.getY(), bblock.getZ());
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                toBlow.add(coords);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-22 19:42:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            if (cancelled) {
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                this.wasCanceled = true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                return;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+            // CraftBukkit end
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+            objectlistiterator = this.toBlow.iterator();
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								             while (objectlistiterator.hasNext()) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 BlockPosition blockposition = (BlockPosition) objectlistiterator.next();
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-27 20:34:19 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -272,8 +364,8 @@
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                             TileEntity tileentity = iblockdata.hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).withRandom(this.level.random).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, this.source);
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2022-12-08 03:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-                            if (this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY) {
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								-                                loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius);
							 | 
						
					
						
							
								
									
										
										
										
											2023-03-04 11:47:05 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                            if (yield < 1.0F) { // CraftBukkit - add yield
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                                loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                             }
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                             iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag2);
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-27 20:34:19 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -305,7 +397,11 @@
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-08 02:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 BlockPosition blockposition2 = (BlockPosition) objectlistiterator1.next();
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                 if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition2).isAir() && this.level.getBlockState(blockposition2.below()).isSolidRender(this.level, blockposition2.below())) {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								-                    this.level.setBlockAndUpdate(blockposition2, BlockFireAbstract.getState(this.level, blockposition2));
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                    // CraftBukkit start - Ignition by explosion
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-11 15:00:00 +10:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                    if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), this).isCancelled()) {
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+                        this.level.setBlockAndUpdate(blockposition2, BlockFireAbstract.getState(this.level, blockposition2));
							 | 
						
					
						
							
								
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                    }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								+                    // CraftBukkit end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                 }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								             }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         }
							 | 
						
					
						
							
								
									
										
										
										
											2023-02-27 20:34:19 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								@@ -317,6 +413,7 @@
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-13 14:06:25 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							
								
									
										
										
										
											2021-11-22 09:00:00 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								     private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPosition>> objectarraylist, ItemStack itemstack, BlockPosition blockposition) {
							 | 
						
					
						
							
								
									
										
										
										
											2019-12-13 14:06:25 +11:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								+        if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-5425
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         int i = objectarraylist.size();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								         for (int j = 0; j < i; ++j) {
							 |