mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 01:12:47 +01:00
b5b481da62
Remove chunk neighbour system until we can figure out the chunk system
36 lines
1.9 KiB
Diff
36 lines
1.9 KiB
Diff
From e1761ca14d86a46faf103fcf2d34fd79e208a14a 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/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
index 8e40027acf..eee03e39b1 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
@@ -675,11 +675,16 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
int chunkRange = world.spigotConfig.mobSpawnRange;
|
|
chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange;
|
|
chunkRange = (chunkRange > 8) ? 8 : chunkRange;
|
|
-
|
|
- double blockRange = Math.pow(chunkRange << 4, 2);
|
|
+ final int finalChunkRange = chunkRange; // Paper for lambda below
|
|
+ //double blockRange = Math.pow(chunkRange << 4, 2); // Paper - use the range from the event
|
|
// Spigot end
|
|
|
|
return this.y.a(chunkcoordintpair.pair()).noneMatch((entityplayer) -> {
|
|
+ // Paper start -
|
|
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event // TODO deal with int->byte on review (as well as the mess that this code is)
|
|
+ = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityplayer.getBukkitEntity(), (byte)finalChunkRange);
|
|
+ final double blockRange = (double)((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
|
|
+ // Paper end
|
|
return !entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
|
|
});
|
|
}
|
|
--
|
|
2.21.0
|
|
|