2019-03-20 02:46:00 +01:00
|
|
|
From cc85d73644b4dcfeae066be7202558d876062be0 Mon Sep 17 00:00:00 2001
|
2018-01-14 23:36:24 +01:00
|
|
|
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
|
2019-03-20 02:46:00 +01:00
|
|
|
index b57616960..e62616552 100644
|
2018-01-14 23:36:24 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
2018-07-18 20:55:52 +02:00
|
|
|
@@ -47,6 +47,15 @@ public final class SpawnerCreature {
|
2018-01-14 23:36:24 +01:00
|
|
|
byte b0 = worldserver.spigotConfig.mobSpawnRange;
|
2018-09-09 20:38:27 +02:00
|
|
|
b0 = ( b0 > entityhuman.getViewDistance() ) ? (byte) entityhuman.getViewDistance() : b0; // Paper - Use player view distance API
|
2018-01-14 23:36:24 +01:00
|
|
|
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) {
|
|
|
|
--
|
2019-03-20 02:46:00 +01:00
|
|
|
2.21.0
|
2018-01-14 23:36:24 +01:00
|
|
|
|