From 5d0d11e4b6d87d5dd525efb7020456508476abb1 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Tue, 23 Nov 2021 19:42:31 -0800
Subject: [PATCH] Patches
---
build-data/paper.at | 4 +
...0177-Fix-Spigot-annotation-mistakes.patch} | 12 +--
.../0178-Server-Tick-Events.patch} | 0
...179-PlayerDeathEvent-getItemsToKeep.patch} | 2 +-
.../0180-Add-Heightmap-API.patch} | 2 +-
.../0181-Mob-Spawner-API-Enhancements.patch} | 0
.../0182-Add-BlockSoundGroup-interface.patch} | 8 +-
...actAtEntityEvent-javadoc-for-ArmorS.patch} | 0
.../0023-Player-affects-spawning-API.patch | 4 +-
...for-pickupDelay-breaks-picking-up-i.patch} | 6 +-
.../0319-Server-Tick-Events.patch} | 9 +-
...320-PlayerDeathEvent-getItemsToKeep.patch} | 6 +-
...Optimize-Captured-TileEntity-Lookup.patch} | 6 +-
.../0322-Add-Heightmap-API.patch} | 2 +-
.../0323-Mob-Spawner-API-Enhancements.patch} | 96 +++++++------------
...-to-changed-postToMainThread-method.patch} | 4 +-
...-item-frames-are-modified-MC-123450.patch} | 2 +-
...sPrimaryThread-and-MinecraftServer-.patch} | 8 +-
...27-improve-CraftWorld-isChunkLoaded.patch} | 2 +-
...0328-Implement-CraftBlockSoundGroup.patch} | 9 +-
20 files changed, 79 insertions(+), 103 deletions(-)
rename patches/{unapplied/api/0178-Fix-Spigot-annotation-mistakes.patch => api/0177-Fix-Spigot-annotation-mistakes.patch} (94%)
rename patches/{unapplied/api/0179-Server-Tick-Events.patch => api/0178-Server-Tick-Events.patch} (100%)
rename patches/{unapplied/api/0180-PlayerDeathEvent-getItemsToKeep.patch => api/0179-PlayerDeathEvent-getItemsToKeep.patch} (96%)
rename patches/{unapplied/api/0181-Add-Heightmap-API.patch => api/0180-Add-Heightmap-API.patch} (99%)
rename patches/{unapplied/api/0182-Mob-Spawner-API-Enhancements.patch => api/0181-Mob-Spawner-API-Enhancements.patch} (100%)
rename patches/{unapplied/api/0183-Add-BlockSoundGroup-interface.patch => api/0182-Add-BlockSoundGroup-interface.patch} (89%)
rename patches/{unapplied/api/0184-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch => api/0183-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch} (100%)
rename patches/{unapplied/server/0320-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch => server/0318-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch} (86%)
rename patches/{unapplied/server/0321-Server-Tick-Events.patch => server/0319-Server-Tick-Events.patch} (83%)
rename patches/{unapplied/server/0322-PlayerDeathEvent-getItemsToKeep.patch => server/0320-PlayerDeathEvent-getItemsToKeep.patch} (92%)
rename patches/{unapplied/server/0323-Optimize-Captured-TileEntity-Lookup.patch => server/0321-Optimize-Captured-TileEntity-Lookup.patch} (85%)
rename patches/{unapplied/server/0324-Add-Heightmap-API.patch => server/0322-Add-Heightmap-API.patch} (95%)
rename patches/{unapplied/server/0325-Mob-Spawner-API-Enhancements.patch => server/0323-Mob-Spawner-API-Enhancements.patch} (51%)
rename patches/{unapplied/server/0326-Fix-CB-call-to-changed-postToMainThread-method.patch => server/0324-Fix-CB-call-to-changed-postToMainThread-method.patch} (86%)
rename patches/{unapplied/server/0327-Fix-sounds-when-item-frames-are-modified-MC-123450.patch => server/0325-Fix-sounds-when-item-frames-are-modified-MC-123450.patch} (91%)
rename patches/{unapplied/server/0328-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch => server/0326-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch} (86%)
rename patches/{unapplied/server/0329-improve-CraftWorld-isChunkLoaded.patch => server/0327-improve-CraftWorld-isChunkLoaded.patch} (94%)
rename patches/{unapplied/server/0332-Implement-CraftBlockSoundGroup.patch => server/0328-Implement-CraftBlockSoundGroup.patch} (88%)
diff --git a/build-data/paper.at b/build-data/paper.at
index dba668950c..cf8a486b80 100644
--- a/build-data/paper.at
+++ b/build-data/paper.at
@@ -36,6 +36,10 @@ public net.minecraft.network.protocol.game.ServerboundInteractPacket$ActionType
# Configurable RCON IP address
public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String;
+# Mob Spawner API Enhancements
+public net.minecraft.world.level.BaseSpawner isNearPlayer(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z
+public net.minecraft.world.level.BaseSpawner delay(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V
+
# LootTable API
public org.bukkit.craftbukkit.block.CraftBlockEntityState getTileEntity()Lnet/minecraft/world/level/block/entity/BlockEntity;
public org.bukkit.craftbukkit.block.CraftLootable setLootTable(Lorg/bukkit/loot/LootTable;J)V
diff --git a/patches/unapplied/api/0178-Fix-Spigot-annotation-mistakes.patch b/patches/api/0177-Fix-Spigot-annotation-mistakes.patch
similarity index 94%
rename from patches/unapplied/api/0178-Fix-Spigot-annotation-mistakes.patch
rename to patches/api/0177-Fix-Spigot-annotation-mistakes.patch
index 55cea0d383..c4a2bdab4c 100644
--- a/patches/unapplied/api/0178-Fix-Spigot-annotation-mistakes.patch
+++ b/patches/api/0177-Fix-Spigot-annotation-mistakes.patch
@@ -9,10 +9,10 @@ a ton of noise to plugin developers.
These do not help plugin developers if they bring moise noise than value.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
-index a10ad183431d2a67e8f49062fba37e7fc3b760dc..5c7681809a27796e398170fc72bf0a950e52a971 100644
+index 80517b3bc7fe470c418cf9343c86b151ad9a702a..50412ec90cd480b7457dd30723d4978fb90fae72 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
-@@ -1519,7 +1519,7 @@ public final class Bukkit {
+@@ -1533,7 +1533,7 @@ public final class Bukkit {
*
* @return the scoreboard manager or null if no worlds are loaded.
*/
@@ -21,7 +21,7 @@ index a10ad183431d2a67e8f49062fba37e7fc3b760dc..5c7681809a27796e398170fc72bf0a95
public static ScoreboardManager getScoreboardManager() {
return server.getScoreboardManager();
}
-@@ -1816,7 +1816,7 @@ public final class Bukkit {
+@@ -1830,7 +1830,7 @@ public final class Bukkit {
* @param clazz the class of the tag entries
* @return the tag or null
*/
@@ -62,10 +62,10 @@ index 88b3e0323dbc4f0fce31b147c7aaa08d65745852..23ca89dde7f6ac9082d4b97fce295942
if (this.world == null) {
return null;
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
-index 27353a3eb4669ee457fe7d65dc5dd5e8c23c8283..5162e8b356e73ac41d6f4f5a0ea0efeda85382c7 100644
+index 2534560ccc8340500b71572ee6121df8ec06e154..5d3479f494e874d9824b178bfc0664d81e9b5649 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
-@@ -1286,7 +1286,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
+@@ -1298,7 +1298,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*
* @return the scoreboard manager or null if no worlds are loaded.
*/
@@ -74,7 +74,7 @@ index 27353a3eb4669ee457fe7d65dc5dd5e8c23c8283..5162e8b356e73ac41d6f4f5a0ea0efed
ScoreboardManager getScoreboardManager();
/**
-@@ -1556,7 +1556,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
+@@ -1568,7 +1568,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param clazz the class of the tag entries
* @return the tag or null
*/
diff --git a/patches/unapplied/api/0179-Server-Tick-Events.patch b/patches/api/0178-Server-Tick-Events.patch
similarity index 100%
rename from patches/unapplied/api/0179-Server-Tick-Events.patch
rename to patches/api/0178-Server-Tick-Events.patch
diff --git a/patches/unapplied/api/0180-PlayerDeathEvent-getItemsToKeep.patch b/patches/api/0179-PlayerDeathEvent-getItemsToKeep.patch
similarity index 96%
rename from patches/unapplied/api/0180-PlayerDeathEvent-getItemsToKeep.patch
rename to patches/api/0179-PlayerDeathEvent-getItemsToKeep.patch
index e41136bc7f..7637e58a20 100644
--- a/patches/unapplied/api/0180-PlayerDeathEvent-getItemsToKeep.patch
+++ b/patches/api/0179-PlayerDeathEvent-getItemsToKeep.patch
@@ -8,7 +8,7 @@ Exposes a mutable array on items a player should keep on death
Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
-index a01d4c21bedc7f1a54f5a330bb4c2909ce3a18e4..8c46eaebf004823c1c31eb2c7304181487cb1332 100644
+index 48f272747b8d5ab43f79a9d474713aca79f121b7..61d12cb8f0a924abf696b6da7258f34dbb7b51b6 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -36,7 +36,6 @@ public class PlayerDeathEvent extends EntityDeathEvent {
diff --git a/patches/unapplied/api/0181-Add-Heightmap-API.patch b/patches/api/0180-Add-Heightmap-API.patch
similarity index 99%
rename from patches/unapplied/api/0181-Add-Heightmap-API.patch
rename to patches/api/0180-Add-Heightmap-API.patch
index 8ef3a8afb6..5f54b14be5 100644
--- a/patches/unapplied/api/0181-Add-Heightmap-API.patch
+++ b/patches/api/0180-Add-Heightmap-API.patch
@@ -103,7 +103,7 @@ index 23ca89dde7f6ac9082d4b97fce2959425f3680cb..8321441b8f528a05e297f485672f928e
* Creates explosion at this location with given power
*
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
-index e4d3618afa8a022ae556febd23be76b5fe6dfe0e..bcac107353149d0129571a3548965a407aa7640c 100644
+index 614c04c31c95e9a404b5caac3e07285ce2c58367..ed97f1f2566582df2c1794856caefff5bedb0fb0 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -160,6 +160,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
diff --git a/patches/unapplied/api/0182-Mob-Spawner-API-Enhancements.patch b/patches/api/0181-Mob-Spawner-API-Enhancements.patch
similarity index 100%
rename from patches/unapplied/api/0182-Mob-Spawner-API-Enhancements.patch
rename to patches/api/0181-Mob-Spawner-API-Enhancements.patch
diff --git a/patches/unapplied/api/0183-Add-BlockSoundGroup-interface.patch b/patches/api/0182-Add-BlockSoundGroup-interface.patch
similarity index 89%
rename from patches/unapplied/api/0183-Add-BlockSoundGroup-interface.patch
rename to patches/api/0182-Add-BlockSoundGroup-interface.patch
index 566c91565a..0edfea3df9 100644
--- a/patches/unapplied/api/0183-Add-BlockSoundGroup-interface.patch
+++ b/patches/api/0182-Add-BlockSoundGroup-interface.patch
@@ -64,13 +64,13 @@ index 0000000000000000000000000000000000000000..8cf87d228a7006658d52ce0da16c2d74
+ Sound getFallSound();
+}
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
-index 18ab5cca036522df2d245f755d6c67904e6398e8..5ac36e0f90d0889853736390877aa92ec0ca181b 100644
+index 79c0fa47a0d733d1547f8926d88169939c986d8c..5e92f8f6ba5368ae934c24154ab13fbc6a46272f 100644
--- a/src/main/java/org/bukkit/block/Block.java
+++ b/src/main/java/org/bukkit/block/Block.java
-@@ -587,4 +587,16 @@ public interface Block extends Metadatable {
+@@ -596,4 +596,16 @@ public interface Block extends Metadatable {
+ * @return true
if the block data can be placed here
*/
- @NotNull
- VoxelShape getCollisionShape();
+ boolean canPlace(@NotNull BlockData data);
+
+ // Paper start
+ /**
diff --git a/patches/unapplied/api/0184-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch b/patches/api/0183-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch
similarity index 100%
rename from patches/unapplied/api/0184-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch
rename to patches/api/0183-Amend-PlayerInteractAtEntityEvent-javadoc-for-ArmorS.patch
diff --git a/patches/server/0023-Player-affects-spawning-API.patch b/patches/server/0023-Player-affects-spawning-API.patch
index 14cc9e5af3..31f32b3c8f 100644
--- a/patches/server/0023-Player-affects-spawning-API.patch
+++ b/patches/server/0023-Player-affects-spawning-API.patch
@@ -61,13 +61,13 @@ index d149ecefb0ee379f3fa7e64e4d70bdd23adbd49b..5d37c82bd5cd20aa2d452f0214f33037
// CraftBukkit start
public boolean fauxSleeping;
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
-index a0ac89c6b27b2de0055e551df613247b23288b6c..b3a4c907bb15907d82e58247cb049e3f9fcf990e 100644
+index 62dc233b6d53c28b8c64a372f60f87e258a7c2a6..08d9980a5b9b26f7dbdfcb6cda7a3995d58bea81 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -51,7 +51,7 @@ public abstract class BaseSpawner {
}
- private boolean isNearPlayer(Level world, BlockPos pos) {
+ public boolean isNearPlayer(Level world, BlockPos pos) {
- return world.hasNearbyAlivePlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange);
+ return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper
}
diff --git a/patches/unapplied/server/0320-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/patches/server/0318-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch
similarity index 86%
rename from patches/unapplied/server/0320-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch
rename to patches/server/0318-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch
index 48f380970f..cb89ee5b2a 100644
--- a/patches/unapplied/server/0320-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch
+++ b/patches/server/0318-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch
@@ -6,10 +6,10 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
-index 0741dcbd06395b4696eb6083128a5d9b679cb3fb..82ffe3624943d2e931e2cc2f85ede94f369bd06b 100644
+index 2716fb59e83e2e2bca845bd1b58c5aefb7aa89a0..f3991a30f634122020ca6334bc6f2ca84e93ecac 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
-@@ -105,6 +105,7 @@ public class ItemEntity extends Entity {
+@@ -106,6 +106,7 @@ public class ItemEntity extends Entity {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
@@ -17,7 +17,7 @@ index 0741dcbd06395b4696eb6083128a5d9b679cb3fb..82ffe3624943d2e931e2cc2f85ede94f
if (this.age != -32768) this.age += elapsedTicks;
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
-@@ -193,6 +194,7 @@ public class ItemEntity extends Entity {
+@@ -192,6 +193,7 @@ public class ItemEntity extends Entity {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
diff --git a/patches/unapplied/server/0321-Server-Tick-Events.patch b/patches/server/0319-Server-Tick-Events.patch
similarity index 83%
rename from patches/unapplied/server/0321-Server-Tick-Events.patch
rename to patches/server/0319-Server-Tick-Events.patch
index 0415691d31..50e690b507 100644
--- a/patches/unapplied/server/0321-Server-Tick-Events.patch
+++ b/patches/server/0319-Server-Tick-Events.patch
@@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events
Fires event at start and end of a server tick
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index e7fefa95597d4c7388052731a79b8c7c55d2a766..1a7a9315893887227da8bc39230b656b79f96f49 100644
+index 76923773118ac2f152ba7b3a0bb5d0e71d95533c..e512c30390953b90c9709f30d55585a1379141db 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
-@@ -1330,6 +1330,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop EMPTY_POTENTIALS = WeightedRandomList.create();
-+ public static WeightedRandomList EMPTY_POTENTIALS = WeightedRandomList.create(); // Paper - private->public
- public int spawnDelay = 20;
- public WeightedRandomList spawnPotentials;
- public SpawnData nextSpawnData;
-@@ -77,7 +77,7 @@ public abstract class BaseSpawner {
- this.spawnPotentials = BaseSpawner.EMPTY_POTENTIALS; // CraftBukkit - SPIGOT-3496, MC-92282
- }
-
-- private boolean isNearPlayer(Level world, BlockPos pos) {
-+ public boolean isNearPlayer(Level world, BlockPos pos) { // Paper private->public
- return world.isAffectsSpawningPlayerNearby((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper
- }
-
-@@ -226,7 +226,7 @@ public abstract class BaseSpawner {
- }
- }
-
-- private void delay(Level world, BlockPos pos) {
-+ public void delay(Level world, BlockPos pos) { // Paper private->public
- if (this.maxSpawnDelay <= this.minSpawnDelay) {
- this.spawnDelay = this.minSpawnDelay;
- } else {
-@@ -240,7 +240,13 @@ public abstract class BaseSpawner {
+@@ -230,7 +230,13 @@ public abstract class BaseSpawner {
}
public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) {
@@ -46,14 +19,13 @@ index 24b99df8854902958a72dd14fa15e32f847cc02b..47ca1710ae3ef93a4a1a7444dbabfa53
this.spawnDelay = nbt.getShort("Delay");
+ }
+ // Paper end
- List list = Lists.newArrayList();
+ boolean flag = nbt.contains("SpawnPotentials", 9);
+ boolean flag1 = nbt.contains("SpawnData", 10);
- if (nbt.contains("SpawnPotentials", 9)) {
-@@ -259,10 +265,15 @@ public abstract class BaseSpawner {
- this.setNextSpawnData(world, pos, mobspawnerdata);
- });
+@@ -266,9 +272,15 @@ public abstract class BaseSpawner {
+ }
}
--
+
+ // Paper start - use ints if set
+ if (nbt.contains("Paper.MinSpawnDelay", 99)) {
+ this.minSpawnDelay = nbt.getInt("Paper.MinSpawnDelay");
@@ -63,37 +35,37 @@ index 24b99df8854902958a72dd14fa15e32f847cc02b..47ca1710ae3ef93a4a1a7444dbabfa53
if (nbt.contains("MinSpawnDelay", 99)) {
- this.minSpawnDelay = nbt.getShort("MinSpawnDelay");
- this.maxSpawnDelay = nbt.getShort("MaxSpawnDelay");
-+ this.minSpawnDelay = nbt.getInt("MinSpawnDelay"); // Paper - short->int
-+ this.maxSpawnDelay = nbt.getInt("MaxSpawnDelay"); // Paper - short->int
++ this.minSpawnDelay = nbt.getInt("MinSpawnDelay"); // Paper - short -> int
++ this.maxSpawnDelay = nbt.getInt("MaxSpawnDelay"); // Paper - short -> int
this.spawnCount = nbt.getShort("SpawnCount");
}
-@@ -284,9 +295,20 @@ public abstract class BaseSpawner {
- if (minecraftkey == null) {
- return nbt;
- } else {
-- nbt.putShort("Delay", (short) this.spawnDelay);
-- nbt.putShort("MinSpawnDelay", (short) this.minSpawnDelay);
-- nbt.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
-+ // Paper start
-+ if (spawnDelay > Short.MAX_VALUE) {
-+ nbt.putInt("Paper.Delay", this.spawnDelay);
-+ }
-+ nbt.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay));
+@@ -285,9 +297,20 @@ public abstract class BaseSpawner {
+ }
+
+ public CompoundTag save(CompoundTag nbttagcompound) {
+- nbttagcompound.putShort("Delay", (short) this.spawnDelay);
+- nbttagcompound.putShort("MinSpawnDelay", (short) this.minSpawnDelay);
+- nbttagcompound.putShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
++ // Paper start
++ if (spawnDelay > Short.MAX_VALUE) {
++ nbttagcompound.putInt("Paper.Delay", this.spawnDelay);
++ }
++ nbttagcompound.putShort("Delay", (short) Math.min(Short.MAX_VALUE, this.spawnDelay));
+
-+ if (minSpawnDelay > Short.MAX_VALUE || maxSpawnDelay > Short.MAX_VALUE) {
-+ nbt.putInt("Paper.MinSpawnDelay", this.minSpawnDelay);
-+ nbt.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay);
-+ }
++ if (minSpawnDelay > Short.MAX_VALUE || maxSpawnDelay > Short.MAX_VALUE) {
++ nbttagcompound.putInt("Paper.MinSpawnDelay", this.minSpawnDelay);
++ nbttagcompound.putInt("Paper.MaxSpawnDelay", this.maxSpawnDelay);
++ }
+
-+ nbt.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay));
-+ nbt.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay));
-+ // Paper end
- nbt.putShort("SpawnCount", (short) this.spawnCount);
- nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
- nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
++ nbttagcompound.putShort("MinSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.minSpawnDelay));
++ nbttagcompound.putShort("MaxSpawnDelay", (short) Math.min(Short.MAX_VALUE, this.maxSpawnDelay));
++ // Paper end
+ nbttagcompound.putShort("SpawnCount", (short) this.spawnCount);
+ nbttagcompound.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
+ nbttagcompound.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
-index 38dc811970b8f90b11a2b0013da3b6b3b775cbec..b6c1460e342685c9c3c418be786d9b19c006184b 100644
+index 6c427b15f78970912bae881f5aba1cfae2a4ba53..128a675a5af5148216dfa4bea6a5762b639f69f6 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -116,4 +116,30 @@ public class CraftCreatureSpawner extends CraftBlockEntityState