mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 07:17:46 +01:00
Resolve TODO on PlayerNaturallySpawnCreaturesEvent
- Add missing isCancelled check We don't need to worry about going out of range of int since the value is clamped to view distance, and view distance is clamped to 33
This commit is contained in:
parent
a13710cccf
commit
8d7a074503
@ -9,7 +9,7 @@ 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
|
||||
index 8e40027ac..e44570c60 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
@ -23,12 +23,14 @@ index 8e40027acf..eee03e39b1 100644
|
||||
// Spigot end
|
||||
|
||||
return this.y.a(chunkcoordintpair.pair()).noneMatch((entityplayer) -> {
|
||||
- return !entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
|
||||
+ // 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)
|
||||
+ com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event
|
||||
+ = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityplayer.getBukkitEntity(), (byte)finalChunkRange);
|
||||
+ final double blockRange = (double)((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
|
||||
+ return event.isCancelled() || (!entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange); // Spigot
|
||||
+ // Paper end
|
||||
return !entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
|
||||
});
|
||||
}
|
||||
|
||||
--
|
Loading…
Reference in New Issue
Block a user