2022-12-07 17:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
|
|
|
+++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
2023-09-02 04:55:23 +02:00
|
|
|
@@ -11,6 +11,13 @@
|
2022-12-07 17:00:00 +01:00
|
|
|
import net.minecraft.world.level.chunk.Chunk;
|
|
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.Bukkit;
|
2023-09-02 04:55:23 +02:00
|
|
|
+import org.bukkit.craftbukkit.CraftGameEvent;
|
2023-04-19 11:59:19 +02:00
|
|
|
+import org.bukkit.craftbukkit.util.CraftLocation;
|
2022-12-07 17:00:00 +01:00
|
|
|
+import org.bukkit.event.world.GenericGameEvent;
|
|
|
|
+// CraftBukkit end
|
|
|
|
+
|
|
|
|
public class GameEventDispatcher {
|
|
|
|
|
|
|
|
private final WorldServer level;
|
2023-09-02 04:55:23 +02:00
|
|
|
@@ -22,6 +29,14 @@
|
2022-12-07 17:00:00 +01:00
|
|
|
public void post(GameEvent gameevent, Vec3D vec3d, GameEvent.a gameevent_a) {
|
|
|
|
int i = gameevent.getNotificationRadius();
|
2023-03-14 17:30:00 +01:00
|
|
|
BlockPosition blockposition = BlockPosition.containing(vec3d);
|
2022-12-07 17:00:00 +01:00
|
|
|
+ // CraftBukkit start
|
2023-09-02 04:55:23 +02:00
|
|
|
+ GenericGameEvent event = new GenericGameEvent(CraftGameEvent.minecraftToBukkit(gameevent), CraftLocation.toBukkit(blockposition, level.getWorld()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
|
2022-12-07 17:00:00 +01:00
|
|
|
+ level.getCraftServer().getPluginManager().callEvent(event);
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ i = event.getRadius();
|
|
|
|
+ // CraftBukkit end
|
|
|
|
int j = SectionPosition.blockToSectionCoord(blockposition.getX() - i);
|
|
|
|
int k = SectionPosition.blockToSectionCoord(blockposition.getY() - i);
|
|
|
|
int l = SectionPosition.blockToSectionCoord(blockposition.getZ() - i);
|