Paper/patches/server/0210-Expand-Explosions-API.patch

25 lines
1.5 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Jun 2018 23:17:24 -0400
Subject: [PATCH] Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 4a83fa80d11a5ef840cd556f845b4de84b3ad5f1..ffcaf40f8e310ef4ed292dac673a4e1da6dff0ea 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -707,6 +707,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
2021-06-11 14:02:28 +02:00
public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) {
2021-06-12 21:30:37 +02:00
return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? Explosion.BlockInteraction.BREAK : Explosion.BlockInteraction.NONE).wasCanceled;
2021-06-11 14:02:28 +02:00
}
+ // Paper start
2021-06-12 21:30:37 +02:00
+ @Override
2021-06-11 14:02:28 +02:00
+ public boolean createExplosion(Entity source, Location loc, float power, boolean setFire, boolean breakBlocks) {
+ return !world.explode(source != null ? ((org.bukkit.craftbukkit.entity.CraftEntity) source).getHandle() : null, loc.getX(), loc.getY(), loc.getZ(), power, setFire, breakBlocks ? Explosion.BlockInteraction.BREAK : Explosion.BlockInteraction.NONE).wasCanceled;
+ }
+ // Paper end
@Override
public boolean createExplosion(Location loc, float power) {