diff --git a/patches/unapplied/server/0302-Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/patches/server/0302-Don-t-check-ConvertSigns-boolean-every-sign-save.patch similarity index 93% rename from patches/unapplied/server/0302-Don-t-check-ConvertSigns-boolean-every-sign-save.patch rename to patches/server/0302-Don-t-check-ConvertSigns-boolean-every-sign-save.patch index 1f80323016..0d3af0b6f8 100644 --- a/patches/unapplied/server/0302-Don-t-check-ConvertSigns-boolean-every-sign-save.patch +++ b/patches/server/0302-Don-t-check-ConvertSigns-boolean-every-sign-save.patch @@ -7,7 +7,7 @@ property lookups arent super cheap. they synchronize, validate and check security managers. diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index 3a2e2adeefe73981b443216724270023408c1feb..615c4f9d9841f7ddc3e5c854e90f41c3905c2e8f 100644 +index 39bd98b9496e4a27fd69a2de7c83c40689017ebc..831db5ee21938d71e99bf9d17b92a6ca15531740 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java @@ -25,6 +25,7 @@ import net.minecraft.world.phys.Vec2; diff --git a/patches/unapplied/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 97% rename from patches/unapplied/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index bdd97d4256..33cf971f1f 100644 --- a/patches/unapplied/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/patches/server/0303-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -28,7 +28,7 @@ and then catch exceptions and close if they fire. Part of this commit was authored by: Spottedleaf diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 3559f6c54e7674d3eaf023d2ceaee13edfcae5b2..a0d3d9e344f530b713167d0663634c40eefce5b5 100644 +index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f508e3dd125 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java @@ -97,6 +97,10 @@ public class Connection extends SimpleChannelInboundHandler> { @@ -265,7 +265,7 @@ index 3559f6c54e7674d3eaf023d2ceaee13edfcae5b2..a0d3d9e344f530b713167d0663634c40 if (this.getDisconnectedReason() != null) { @@ -429,7 +561,7 @@ public class Connection extends SimpleChannelInboundHandler> { } else if (this.getPacketListener() != null) { - this.getPacketListener().onDisconnect(new TranslatableComponent("multiplayer.disconnect.generic")); + this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic")); } - this.queue.clear(); // Free up packet queue. + clearPacketQueue(); // Paper @@ -297,10 +297,10 @@ index 74bfe0d3942259c45702b099efdc4e101a4e3022..e8fcd56906d26f6dc87959e32c4c7c78 return false; } diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index e174d9803e557470068f7893260d55a042888517..7c820a8f9ae85eb6941dce0e6296775fb331d720 100644 +index 5e1a6f2cd2d0d9c6b17c446fa782e4089cc138d5..78808e6239070121d36b6c377202d76e8fb3fa32 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -@@ -63,10 +63,12 @@ public class ServerConnectionListener { +@@ -64,10 +64,12 @@ public class ServerConnectionListener { final List connections = Collections.synchronizedList(Lists.newArrayList()); // Paper start - prevent blocking on adding a new network manager while the server is ticking private final java.util.Queue pending = new java.util.concurrent.ConcurrentLinkedQueue<>(); @@ -313,7 +313,7 @@ index e174d9803e557470068f7893260d55a042888517..7c820a8f9ae85eb6941dce0e6296775f } } // Paper end -@@ -101,6 +103,7 @@ public class ServerConnectionListener { +@@ -102,6 +104,7 @@ public class ServerConnectionListener { ; } diff --git a/patches/unapplied/server/0304-Handle-Oversized-Tile-Entities-in-chunks.patch b/patches/server/0304-Handle-Oversized-Tile-Entities-in-chunks.patch similarity index 97% rename from patches/unapplied/server/0304-Handle-Oversized-Tile-Entities-in-chunks.patch rename to patches/server/0304-Handle-Oversized-Tile-Entities-in-chunks.patch index f3b5f4619c..ff4ce1a05f 100644 --- a/patches/unapplied/server/0304-Handle-Oversized-Tile-Entities-in-chunks.patch +++ b/patches/server/0304-Handle-Oversized-Tile-Entities-in-chunks.patch @@ -9,7 +9,7 @@ creating too large of a packet to sed. Co authored by Spottedleaf diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index b89965c73bb6f40e688bd29daf6630ccce054100..d004997cb94648a24135f0478be3a25393b67925 100644 +index a7e49476b3e0e46f97cb2cb57377f7ffe5146501..7cf356a700e47686e093e2f2f880af919dc0414a 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData { diff --git a/patches/unapplied/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch b/patches/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch similarity index 90% rename from patches/unapplied/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch rename to patches/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch index 9ca84565f0..24c7e26760 100644 --- a/patches/unapplied/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch +++ b/patches/server/0305-Set-Zombie-last-tick-at-start-of-drowning-process.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Set Zombie last tick at start of drowning process Fixes GH-1887 diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 273f5eb930a37046900f706f5f710ae3fcc9b6df..0760fcc3bde6b819ae526e2c66486b09a948d98b 100644 +index aa78c218d0709eff043fb7e7f5e9a3f8fa918982..374fccfec47769d2df51056fb6d1948f472a6802 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java @@ -222,6 +222,7 @@ public class Zombie extends Monster { diff --git a/patches/unapplied/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch similarity index 82% rename from patches/unapplied/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch rename to patches/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 62eff92250..7844d9824e 100644 --- a/patches/unapplied/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/patches/server/0306-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9e3272a85e760e65217bd75c3ba9bfe21979fd35..cc8d7d56bf30732482ac2a16bdfb22d2c1b18deb 100644 +index 8ff7ae4af69cd62419b6c51c7a7d957a6550c7b9..056d89f0a8f94e2be94a773068cf2cf52556ce5a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1123,6 +1123,7 @@ public abstract class PlayerList { +@@ -1127,6 +1127,7 @@ public abstract class PlayerList { } public void setUsingWhiteList(boolean whitelistEnabled) { diff --git a/patches/unapplied/server/0308-Entity-getEntitySpawnReason.patch b/patches/server/0307-Entity-getEntitySpawnReason.patch similarity index 84% rename from patches/unapplied/server/0308-Entity-getEntitySpawnReason.patch rename to patches/server/0307-Entity-getEntitySpawnReason.patch index ccf42046f7..cfd1696821 100644 --- a/patches/unapplied/server/0308-Entity-getEntitySpawnReason.patch +++ b/patches/server/0307-Entity-getEntitySpawnReason.patch @@ -10,10 +10,10 @@ persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index b57b6f411442827ec1222fbf5bf87947e325d470..19dc74ab02744c70a3b2c75c0a62edb1cfca1be3 100644 +index a37991c960df688f4890fd1a9d88b2e637f26101..1a5ebca952422de8caded739e1816deb4b1a4d72 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1191,6 +1191,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1209,6 +1209,7 @@ public class ServerLevel extends Level implements WorldGenLevel { return true; } // Paper end @@ -22,10 +22,10 @@ index b57b6f411442827ec1222fbf5bf87947e325d470..19dc74ab02744c70a3b2c75c0a62edb1 // Paper start if (DEBUG_ENTITIES) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index cc8d7d56bf30732482ac2a16bdfb22d2c1b18deb..1de3cb1ed15c9efbc602a46a28bbb3473d6c91e1 100644 +index 056d89f0a8f94e2be94a773068cf2cf52556ce5a..604ce3bcec48f63292020220e463659554ada7e0 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -342,7 +342,7 @@ public abstract class PlayerList { +@@ -346,7 +346,7 @@ public abstract class PlayerList { // CraftBukkit start ServerLevel finalWorldServer = worldserver1; Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { @@ -35,10 +35,10 @@ index cc8d7d56bf30732482ac2a16bdfb22d2c1b18deb..1de3cb1ed15c9efbc602a46a28bbb347 }); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 44c53588c54fd275d3f0c7bb5febb67838c939ce..30b79e3dfbc50fee70d52367092c102dbad2d304 100644 +index 18fe107cee949495d2eb7525526d96390c04b0d6..6f426a028e9158bf6ff554d9b9e1f0d097505ecf 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -70,6 +70,8 @@ import net.minecraft.world.InteractionHand; +@@ -73,6 +73,8 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.Nameable; import net.minecraft.world.damagesource.DamageSource; @@ -47,15 +47,15 @@ index 44c53588c54fd275d3f0c7bb5febb67838c939ce..30b79e3dfbc50fee70d52367092c102d import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.vehicle.Boat; -@@ -168,6 +170,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - } +@@ -190,6 +192,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } - }; -+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; + } // Paper end ++ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -@@ -1874,6 +1877,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + private CraftEntity bukkitEntity; +@@ -1922,6 +1925,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -65,7 +65,7 @@ index 44c53588c54fd275d3f0c7bb5febb67838c939ce..30b79e3dfbc50fee70d52367092c102d // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbt.putBoolean("Paper.FromMobSpawner", true); -@@ -2017,6 +2023,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2065,6 +2071,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -93,10 +93,10 @@ index 44c53588c54fd275d3f0c7bb5febb67838c939ce..30b79e3dfbc50fee70d52367092c102d } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 1c76a59eb25148bf2523e9d68cc165b6cd3e1d23..fafbc8601ba3378b86c660f947e23ec293dd7e7e 100644 +index 3e8848cbf22902b1a0e015ecf9e330c9235bc638..01269e52855f88f5cfd7b57b2dc12f5d3e3c1583 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -179,6 +179,7 @@ public abstract class BaseSpawner { +@@ -181,6 +181,7 @@ public abstract class BaseSpawner { // Spigot End } entity.spawnedViaMobSpawner = true; // Paper @@ -105,10 +105,10 @@ index 1c76a59eb25148bf2523e9d68cc165b6cd3e1d23..fafbc8601ba3378b86c660f947e23ec2 // Spigot Start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 8e6ae581c714c1fec6b1cdc1c26b83772573ab27..b732d9de71e5799969852a22f22e860637f7d64e 100644 +index c752f70b0c05cb7acd8c7cfce92ab05af560671a..5f232c45d6e01943cf1ca1d7802d4915887a6b32 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1238,5 +1238,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1249,5 +1249,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public boolean fromMobSpawner() { return getHandle().spawnedViaMobSpawner; } diff --git a/patches/unapplied/server/0309-Update-entity-Metadata-for-all-tracked-players.patch b/patches/server/0308-Update-entity-Metadata-for-all-tracked-players.patch similarity index 85% rename from patches/unapplied/server/0309-Update-entity-Metadata-for-all-tracked-players.patch rename to patches/server/0308-Update-entity-Metadata-for-all-tracked-players.patch index 06c073fc17..0623ebdcc9 100644 --- a/patches/unapplied/server/0309-Update-entity-Metadata-for-all-tracked-players.patch +++ b/patches/server/0308-Update-entity-Metadata-for-all-tracked-players.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Update entity Metadata for all tracked players diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 861f3790179e18f6192ac8b2fb5d2ecbc54484ad..5e3f489964489e0facc93a823a1cb84b4c8abce7 100644 +index 232341fa41b1962d329cc17f3146e41c51d22164..2c43304fd7a189f399f0e7757dbd593f3f462c37 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -391,6 +391,12 @@ public class ServerEntity { - return ClientboundMoveEntityPacket.packetToEntity(this.xp, this.yp, this.zp); +@@ -371,6 +371,12 @@ public class ServerEntity { + } + // Paper start - Add broadcast method @@ -22,10 +22,10 @@ index 861f3790179e18f6192ac8b2fb5d2ecbc54484ad..5e3f489964489e0facc93a823a1cb84b this.broadcast.accept(packet); if (this.entity instanceof ServerPlayer) { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9933821711eab76bb08be74252639dc3093dfb88..4788c98dc93547f3308cb565eee9cfc4947f91eb 100644 +index ea764d2b935c42f88e8dcaff6ba85e5122dbbcc6..a2947ec5dd0df55e1edc9e2f016a4b618b8c5349 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2309,7 +2309,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser +@@ -2500,7 +2500,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) { // Refresh the current entity metadata diff --git a/patches/unapplied/server/0310-Fire-event-on-GS4-query.patch b/patches/server/0309-Fire-event-on-GS4-query.patch similarity index 99% rename from patches/unapplied/server/0310-Fire-event-on-GS4-query.patch rename to patches/server/0309-Fire-event-on-GS4-query.patch index 35d0794ebf..2365b652c2 100644 --- a/patches/unapplied/server/0310-Fire-event-on-GS4-query.patch +++ b/patches/server/0309-Fire-event-on-GS4-query.patch @@ -26,7 +26,7 @@ index 51cb2644aa516a59e19fecb308d519dbc7e5fb11..e548aa0ca4e1e94ab628614b44fc1156 this.dataOutputStream.write(value); } diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java -index 3ea85dc12a580001c193c4d1fb719234030e1615..61e4fe91ac8648edafd39a952939c667c2838207 100644 +index cf3071d0b1f818995583e58d64194e4ceb927959..29e2bc3fa3091df3c2fa908a2632c3b592c4a872 100644 --- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java +++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java @@ -105,13 +105,32 @@ public class QueryThreadGs4 extends GenericThread { diff --git a/patches/unapplied/server/0311-Implement-PlayerPostRespawnEvent.patch b/patches/server/0310-Implement-PlayerPostRespawnEvent.patch similarity index 86% rename from patches/unapplied/server/0311-Implement-PlayerPostRespawnEvent.patch rename to patches/server/0310-Implement-PlayerPostRespawnEvent.patch index 1f025fa066..41153d8c35 100644 --- a/patches/unapplied/server/0311-Implement-PlayerPostRespawnEvent.patch +++ b/patches/server/0310-Implement-PlayerPostRespawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 1de3cb1ed15c9efbc602a46a28bbb3473d6c91e1..fbed83f8c49267a657a3df1c6e4b42ce2046b052 100644 +index 604ce3bcec48f63292020220e463659554ada7e0..6ef66a4c040ad9ad33d363f212c70621b260b6c7 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -722,9 +722,14 @@ public abstract class PlayerList { +@@ -726,9 +726,14 @@ public abstract class PlayerList { boolean flag2 = false; @@ -24,7 +24,7 @@ index 1de3cb1ed15c9efbc602a46a28bbb3473d6c91e1..fbed83f8c49267a657a3df1c6e4b42ce ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension()); if (worldserver1 != null) { Optional optional; -@@ -776,6 +781,7 @@ public abstract class PlayerList { +@@ -780,6 +785,7 @@ public abstract class PlayerList { location = respawnEvent.getRespawnLocation(); if (!flag) entityplayer.reset(); // SPIGOT-4785 @@ -32,7 +32,7 @@ index 1de3cb1ed15c9efbc602a46a28bbb3473d6c91e1..fbed83f8c49267a657a3df1c6e4b42ce } else { location.setWorld(worldserver.getWorld()); } -@@ -833,6 +839,13 @@ public abstract class PlayerList { +@@ -837,6 +843,13 @@ public abstract class PlayerList { if (entityplayer.connection.isDisconnected()) { this.save(entityplayer); } diff --git a/patches/unapplied/server/0312-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/patches/server/0311-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch similarity index 86% rename from patches/unapplied/server/0312-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch rename to patches/server/0311-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch index 7c58eea21b..c64b131e45 100644 --- a/patches/unapplied/server/0312-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch +++ b/patches/server/0311-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 df5064e69f10bb366572e5f1da197514f3067faf..ff3182c40d2e3942190cac8ddb008ba6c5a72d99 100644 +index ab48f572c778924354f30ff05bb45f3b235817af..75575f73ab0f4b7fad92843a1d11bae059b50366 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -106,6 +106,7 @@ public class ItemEntity extends Entity { +@@ -116,6 +116,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 df5064e69f10bb366572e5f1da197514f3067faf..ff3182c40d2e3942190cac8ddb008ba6 if (this.age != -32768) this.age += elapsedTicks; this.lastTick = MinecraftServer.currentTick; // CraftBukkit end -@@ -192,6 +193,7 @@ public class ItemEntity extends Entity { +@@ -202,6 +203,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/0313-Server-Tick-Events.patch b/patches/server/0312-Server-Tick-Events.patch similarity index 85% rename from patches/unapplied/server/0313-Server-Tick-Events.patch rename to patches/server/0312-Server-Tick-Events.patch index fe53c376cd..b363681d5f 100644 --- a/patches/unapplied/server/0313-Server-Tick-Events.patch +++ b/patches/server/0312-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 067fa77d706a193dd3dcb4cc58d2e1b25840e6f3..dbf70401a93776f422af4386bceaae6fb9883c4f 100644 +index 5407fea80a66c43550b0b557174d710676b5f118..95034c3486ccd7179c4b41c270a252b26ce77a9c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1348,6 +1348,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> readChunk(ChunkPos chunkPos) { +- return this.read(chunkPos).thenApplyAsync((optional) -> { +- return optional.map((nbttagcompound) -> this.upgradeChunkTag(nbttagcompound, chunkPos)); // CraftBukkit +- }, Util.backgroundExecutor()); ++ // Paper start - Cache chunk status on disk ++ try { ++ return CompletableFuture.completedFuture(Optional.ofNullable(this.readConvertChunkSync(chunkPos))); ++ } catch (Throwable thr) { ++ return CompletableFuture.failedFuture(thr); ++ } ++ // Paper end - Cache chunk status on disk + } + + // CraftBukkit start +@@ -1254,6 +1258,63 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + // CraftBukkit end + } + ++ // Paper start - Cache chunk status on disk ++ @Nullable ++ public CompoundTag readConvertChunkSync(ChunkPos pos) throws IOException { ++ CompoundTag nbttagcompound = this.readSync(pos); + // Paper start - Cache chunk status on disk + if (nbttagcompound == null) { + return null; + } + -+ nbttagcompound = this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), pos, level); // CraftBukkit ++ nbttagcompound = this.upgradeChunkTag(nbttagcompound, pos); // CraftBukkit + if (nbttagcompound == null) { + return null; + } @@ -41,14 +54,13 @@ index 04b287c91acef5b9f0b73edb71fbefbb1f08eee6..ebb2b7323b4e11749b7b905cc76863a8 + + // Paper start - chunk status cache "api" + public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) { -+ RegionFile regionFile = regionFileCache.getRegionFileIfLoaded(chunkPos); - -- return nbttagcompound == null ? null : this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), pos, level); // CraftBukkit ++ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFileIfLoaded(chunkPos); ++ + return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); - } - ++ } ++ + public ChunkStatus getChunkStatusOnDisk(ChunkPos chunkPos) throws IOException { -+ RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, true); ++ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, true); + + if (regionFile == null || !regionFileCache.chunkExists(chunkPos)) { + return null; @@ -66,7 +78,7 @@ index 04b287c91acef5b9f0b73edb71fbefbb1f08eee6..ebb2b7323b4e11749b7b905cc76863a8 + } + + public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException { -+ RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, false); ++ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, false); + + regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound)); + } @@ -81,10 +93,10 @@ index 04b287c91acef5b9f0b73edb71fbefbb1f08eee6..ebb2b7323b4e11749b7b905cc76863a8 // Spigot start return this.anyPlayerCloseEnoughForSpawning(pos, false); diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -index a7f173c385f7a96010652b92fe14bffa5f1ffc68..954e141e5617d6d52e2f3008c25fe9e2fe2f0f9a 100644 +index 441d46635caedfae3cb2f46d30b8d9ae95636e7b..e6240f891e396d91e31b02fdf3084be77e9d6697 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java -@@ -290,6 +290,17 @@ public class ChunkStatus { +@@ -292,6 +292,17 @@ public class ChunkStatus { return this.chunkType; } @@ -103,10 +115,10 @@ index a7f173c385f7a96010652b92fe14bffa5f1ffc68..954e141e5617d6d52e2f3008c25fe9e2 return (ChunkStatus) Registry.CHUNK_STATUS.get(ResourceLocation.tryParse(id)); } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 37a60420b993525852492fd6665fb75afee9796f..9a4fe42da43037a65738b978c0c6c9969de59e76 100644 +index 8cc2a2c026eb44461cd94faeb64fb2151d2d3898..8480310bd389ad55b8138a20da59cbcffb973819 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -606,6 +606,17 @@ public class ChunkSerializer { +@@ -623,6 +623,17 @@ public class ChunkSerializer { })); } @@ -188,24 +200,16 @@ index a1bfcdd713c47d8613eb4af7625a64d51161690b..4bc33c31d497aa7d69226ab870fd7890 } catch (Throwable throwable) { if (dataoutputstream != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f782147a7523b952b272ba67c7b85164236379ef..0edb08a391f806e56ed1bd4812eb9c9d2b966bd7 100644 +index 1ca7903bd14d85e8ee95389250fa3228406c2ca9..2fd677796c6393d6997dca455a7daeef191e51b7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -20,6 +20,7 @@ import java.util.Objects; - import java.util.Random; - import java.util.Set; - import java.util.UUID; -+import java.util.concurrent.CompletableFuture; - import java.util.function.Predicate; - import java.util.stream.Collectors; - import net.minecraft.core.BlockPos; -@@ -293,8 +294,22 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -294,9 +294,23 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean isChunkGenerated(int x, int z) { + // Paper start - Fix this method + if (!Bukkit.isPrimaryThread()) { -+ return CompletableFuture.supplyAsync(() -> { ++ return java.util.concurrent.CompletableFuture.supplyAsync(() -> { + return CraftWorld.this.isChunkGenerated(x, z); + }, world.getChunkSource().mainThreadProcessor).join(); + } @@ -217,13 +221,15 @@ index f782147a7523b952b272ba67c7b85164236379ef..0edb08a391f806e56ed1bd4812eb9c9d + return chunk instanceof ImposterProtoChunk || chunk instanceof net.minecraft.world.level.chunk.LevelChunk; + } try { -- return this.world.getChunkSource().getChunkAtIfCachedImmediately(x, z) != null || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null; // Paper (TODO check if the first part can be removed) +- return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)).get().isPresent(); +- } catch (InterruptedException | ExecutionException ex) { + return world.getChunkSource().chunkMap.getChunkStatusOnDisk(new ChunkPos(x, z)) == ChunkStatus.FULL; + // Paper end - } catch (IOException ex) { ++ } catch (IOException ex) { throw new RuntimeException(ex); } -@@ -406,20 +421,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { + } +@@ -407,20 +421,48 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot diff --git a/patches/unapplied/server/0329-Show-blockstate-location-if-we-failed-to-read-it.patch b/patches/server/0327-Show-blockstate-location-if-we-failed-to-read-it.patch similarity index 100% rename from patches/unapplied/server/0329-Show-blockstate-location-if-we-failed-to-read-it.patch rename to patches/server/0327-Show-blockstate-location-if-we-failed-to-read-it.patch diff --git a/patches/unapplied/server/0330-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/patches/server/0328-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch similarity index 94% rename from patches/unapplied/server/0330-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch rename to patches/server/0328-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 69a8b61af0..2bd9674551 100644 --- a/patches/unapplied/server/0330-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/patches/server/0328-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -37,10 +37,10 @@ index 321dedb7bea65c85aaeac338b88e85c6d453325d..98f81bc3277096493ff0a942361bf795 } + diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 1603657d75334c0425e737cd661a4ed724333206..6282d5899fe0b78ecbb6236db178c8231f7cd521 100644 +index 31b330e140d71d9b017e68eab531a59d4f2ed9a2..fedc36ceebaf3e1d267431bdf7db81e25f4d6fd7 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -86,6 +86,13 @@ public final class NaturalSpawner { +@@ -87,6 +87,13 @@ public final class NaturalSpawner { MobCategory enumcreaturetype = entity.getType().getCategory(); if (enumcreaturetype != MobCategory.MISC) { diff --git a/patches/unapplied/server/0331-Configurable-projectile-relative-velocity.patch b/patches/server/0329-Configurable-projectile-relative-velocity.patch similarity index 97% rename from patches/unapplied/server/0331-Configurable-projectile-relative-velocity.patch rename to patches/server/0329-Configurable-projectile-relative-velocity.patch index 6b3d5f802a..1507176747 100644 --- a/patches/unapplied/server/0331-Configurable-projectile-relative-velocity.patch +++ b/patches/server/0329-Configurable-projectile-relative-velocity.patch @@ -40,7 +40,7 @@ index 98f81bc3277096493ff0a942361bf79525000431..b230c79a830375a1d3b9262620f51039 } diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java -index 7837fb0419c94731eba618e903353ddc047bbed6..ccaa97956e40c6a79371d813719f65687991ec5b 100644 +index 80fdb953d7a49b05108672e18ea326182fa7cfd6..fcbc5a3aee2e23a0b30b1f774d608f85b85f7d71 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -161,7 +161,7 @@ public abstract class Projectile extends Entity { diff --git a/patches/unapplied/server/0307-Use-proper-max-length-when-serialising-BungeeCord-te.patch b/patches/unapplied/server/0307-Use-proper-max-length-when-serialising-BungeeCord-te.patch deleted file mode 100644 index 2b7d6b0305..0000000000 --- a/patches/unapplied/server/0307-Use-proper-max-length-when-serialising-BungeeCord-te.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kashike -Date: Wed, 20 Mar 2019 21:19:29 -0700 -Subject: [PATCH] Use proper max length when serialising BungeeCord text - component - - -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -index 8b0d452b12d5eca1f92e2cdf014118e215407b31..cccaaf5ea40eb4d62da4863e4e1b0682fd851f32 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java -@@ -9,6 +9,7 @@ import net.minecraft.network.protocol.Packet; - - public class ClientboundChatPacket implements Packet { - -+ private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper - private final Component message; - public net.kyori.adventure.text.Component adventure$message; // Paper - public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot -@@ -39,9 +40,9 @@ public class ClientboundChatPacket implements Packet { - // buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below - // Paper start - don't nest if we don't need to so that we can preserve formatting - if (this.components.length == 1) { -- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0])); -+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]), MAX_LENGTH); // Paper - use proper max length - } else { -- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components)); -+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components), MAX_LENGTH); // Paper - use proper max length - } - // Paper end - } else { diff --git a/patches/unapplied/server/0321-improve-CraftWorld-isChunkLoaded.patch b/patches/unapplied/server/0321-improve-CraftWorld-isChunkLoaded.patch deleted file mode 100644 index e66756ff92..0000000000 --- a/patches/unapplied/server/0321-improve-CraftWorld-isChunkLoaded.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Tue, 21 May 2019 02:34:04 +0100 -Subject: [PATCH] improve CraftWorld#isChunkLoaded - -getChunkAt will request the chunk using vanillas chunk loading system, -which while we're not going to load the chunk, does involve the server -waiting for the execution queue to get to our request; We can just query -the chunk status and get a response now, vs having to wait - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 7540be1005db97a20d44d55c0e59547113d6ad80..c7e919516254eabd21dc460be4569c44d1fe1176 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -288,13 +288,13 @@ public class CraftWorld extends CraftRegionAccessor implements World { - - @Override - public boolean isChunkLoaded(int x, int z) { -- return this.world.getChunkSource().isChunkLoaded(x, z); -+ return this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z) != null; // Paper - } - - @Override - public boolean isChunkGenerated(int x, int z) { - try { -- return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null; -+ return this.world.getChunkSource().getChunkAtIfCachedImmediately(x, z) != null || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null; // Paper (TODO check if the first part can be removed) - } catch (IOException ex) { - throw new RuntimeException(ex); - }