geforkt von Mirrors/Paper
d627cfa110
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes:17da3420
Fix reading custom persistent entity data83783357
SPIGOT-4980: Shields will not be put on cooldown when hit with an axe8d0f3722
SPIGOT-4752: Fixed inconsistency between isChunkLoaded and chunk load/unload events3f9f31c3
SPIGOT-4982: Armor disappearing while breaking the armor stand
39 Zeilen
2.0 KiB
Diff
39 Zeilen
2.0 KiB
Diff
From cc7a1c0d1bb31906629c1987144297f4119ce6f3 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 f2b024857c..ed9e2e3e18 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
|
@@ -693,12 +693,17 @@ 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.playerMap.a(chunkcoordintpair.pair()).noneMatch((entityplayer) -> {
|
|
- return !entityplayer.isSpectator() && a(chunkcoordintpair, (Entity) entityplayer) < blockRange; // Spigot
|
|
+ // Paper start -
|
|
+ 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
|
|
});
|
|
}
|
|
|
|
--
|
|
2.21.0
|
|
|