diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/gameevent/GameEventDispatcher.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/gameevent/GameEventDispatcher.java.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/gameevent/GameEventDispatcher.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/gameevent/GameEventDispatcher.java.patch new file mode 100644 index 0000000000..cf7dcc844a --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/gameevent/GameEventDispatcher.java.patch @@ -0,0 +1,54 @@ +--- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java ++++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java +@@ -9,6 +10,12 @@ + import net.minecraft.server.level.ServerLevel; + import net.minecraft.world.level.chunk.ChunkAccess; + import net.minecraft.world.phys.Vec3; ++// CraftBukkit start ++import org.bukkit.Bukkit; ++import org.bukkit.craftbukkit.CraftGameEvent; ++import org.bukkit.craftbukkit.util.CraftLocation; ++import org.bukkit.event.world.GenericGameEvent; ++// CraftBukkit end + + public class GameEventDispatcher { + private final ServerLevel level; +@@ -18,18 +26,26 @@ + } + + public void post(GameEvent event, Vec3 pos, GameEvent.Context context) { +- int notificationRadius = event.getNotificationRadius(); +- BlockPos blockPos = BlockPos.containing(pos); +- int i = SectionPos.blockToSectionCoord(blockPos.getX() - notificationRadius); +- int i1 = SectionPos.blockToSectionCoord(blockPos.getY() - notificationRadius); +- int i2 = SectionPos.blockToSectionCoord(blockPos.getZ() - notificationRadius); +- int i3 = SectionPos.blockToSectionCoord(blockPos.getX() + notificationRadius); +- int i4 = SectionPos.blockToSectionCoord(blockPos.getY() + notificationRadius); +- int i5 = SectionPos.blockToSectionCoord(blockPos.getZ() + notificationRadius); +- List<GameEvent.ListenerInfo> list = new ArrayList<>(); +- GameEventListenerRegistry.ListenerVisitor listenerVisitor = (listener, pos1) -> { +- if (listener.getDeliveryMode() == GameEventListener.DeliveryMode.BY_DISTANCE) { +- list.add(new GameEvent.ListenerInfo(event, pos, context, listener, pos1)); ++ int i = event.getNotificationRadius(); ++ BlockPos blockposition = BlockPos.containing(pos); ++ // CraftBukkit start ++ GenericGameEvent event1 = new GenericGameEvent(CraftGameEvent.minecraftToBukkit(event), CraftLocation.toBukkit(blockposition, level.getWorld()), (context.sourceEntity() == null) ? null : context.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread()); ++ level.getCraftServer().getPluginManager().callEvent(event1); ++ if (event1.isCancelled()) { ++ return; ++ } ++ i = event1.getRadius(); ++ // CraftBukkit end ++ int j = SectionPos.blockToSectionCoord(blockposition.getX() - i); ++ int k = SectionPos.blockToSectionCoord(blockposition.getY() - i); ++ int l = SectionPos.blockToSectionCoord(blockposition.getZ() - i); ++ int i1 = SectionPos.blockToSectionCoord(blockposition.getX() + i); ++ int j1 = SectionPos.blockToSectionCoord(blockposition.getY() + i); ++ int k1 = SectionPos.blockToSectionCoord(blockposition.getZ() + i); ++ List<GameEvent.ListenerInfo> list = new ArrayList(); ++ GameEventListenerRegistry.ListenerVisitor gameeventlistenerregistry_a = (gameeventlistener, vec3d1) -> { ++ if (gameeventlistener.getDeliveryMode() == GameEventListener.a.BY_DISTANCE) { ++ list.add(new GameEvent.ListenerInfo(event, pos, context, gameeventlistener, vec3d1)); + } else { + listener.handleGameEvent(this.level, event, context, pos); + } |