Paper/Spigot-Server-Patches/0231-PlayerNaturallySpawnCreaturesEvent.patch
Aikar 05466e3b47
[Auto] Update Upstream
Upstream has released updates that appear to apply compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing.

Bukkit Changes:
d2834556 SPIGOT-4219: Event for PigZombies angering.

CraftBukkit Changes:
a9c796f1 SPIGOT-4184: Fix furnaces not matching Vanilla smelt or animations
195f071e SPIGOT-4219: Event for PigZombies angering.
5e3082c7 SPIGOT-4230: Improve legacy block types
2018-08-05 19:46:43 -04:00

34 lines
1.6 KiB
Diff

From ab7876c48f88df9f243aa3741e46267c3e56444a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 14 Jan 2018 17:36:02 -0500
Subject: [PATCH] PlayerNaturallySpawnCreaturesEvent
This event can be used for when you want to exclude a certain player
from triggering monster spawns on a server.
Also a highly more effecient way to blanket block spawns in a world
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 973c3d1e9e..f525fd1b42 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -47,6 +47,15 @@ public final class SpawnerCreature {
byte b0 = worldserver.spigotConfig.mobSpawnRange;
b0 = ( b0 > worldserver.spigotConfig.viewDistance ) ? (byte) worldserver.spigotConfig.viewDistance : b0;
b0 = ( b0 > 8 ) ? 8 : b0;
+ // Paper start
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
+ event = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(
+ (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), b0);
+ if (!event.callEvent()) {
+ continue;
+ }
+ b0 = event.getSpawnRadius();
+ // Paperr end
for (int i1 = -b0; i1 <= b0; ++i1) {
for (k = -b0; k <= b0; ++k) {
--
2.18.0