mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) 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 Bukkit Changes: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
84 lines
2.5 KiB
Diff
84 lines
2.5 KiB
Diff
From fb78151fa68d3a9ab9cb2cf3659a02595560a03b Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sun, 14 Jan 2018 17:31:37 -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/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java
|
|
new file mode 100644
|
|
index 000000000..112a0dbf5
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PlayerNaturallySpawnCreaturesEvent.java
|
|
@@ -0,0 +1,64 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+import org.bukkit.entity.Player;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.Event;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.player.PlayerEvent;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired when the server is calculating what chunks to try to spawn monsters in every Monster Spawn Tick event
|
|
+ */
|
|
+public class PlayerNaturallySpawnCreaturesEvent extends PlayerEvent implements Cancellable {
|
|
+ private byte radius;
|
|
+
|
|
+ public PlayerNaturallySpawnCreaturesEvent(@NotNull Player player, byte radius) {
|
|
+ super(player);
|
|
+ this.radius = radius;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return The radius of chunks around this player to be included in natural spawn selection
|
|
+ */
|
|
+ public byte getSpawnRadius() {
|
|
+ return radius;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @param radius The radius of chunks around this player to be included in natural spawn selection
|
|
+ */
|
|
+ public void setSpawnRadius(byte radius) {
|
|
+ this.radius = radius;
|
|
+ }
|
|
+
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+
|
|
+ @NotNull
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ private boolean cancelled = false;
|
|
+
|
|
+ /**
|
|
+ * @return If this players chunks will be excluded from natural spawns
|
|
+ */
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @param cancel true if you wish to cancel this event, and not include this players chunks for natural spawning
|
|
+ */
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ cancelled = cancel;
|
|
+ }
|
|
+}
|
|
--
|
|
2.21.0
|
|
|