diff --git a/patches/unapplied/server/0057-Configurable-container-update-tick-rate.patch b/patches/server/0056-Configurable-container-update-tick-rate.patch similarity index 79% rename from patches/unapplied/server/0057-Configurable-container-update-tick-rate.patch rename to patches/server/0056-Configurable-container-update-tick-rate.patch index f3cc5d8814..715ffa53d4 100644 --- a/patches/unapplied/server/0057-Configurable-container-update-tick-rate.patch +++ b/patches/server/0056-Configurable-container-update-tick-rate.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Configurable container update tick rate diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e3e96008d69926c831e5f42b28e1e70160a3c5bd..50264a1da70f120f9adf1619dd72d834ba14e499 100644 +index ab2336a30c1ffc1698c327c031a648d4121c116e..532282ba4432f55596337f7a0898ecc3d5dc2148 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -247,6 +247,7 @@ public class ServerPlayer extends Player { - private RemoteChatSession chatSession; +@@ -262,6 +262,7 @@ public class ServerPlayer extends Player { + public final Object object; private int containerCounter; public boolean wonGame; + private int containerUpdateDelay; // Paper - Configurable container update tick rate // CraftBukkit start - public String displayName; -@@ -639,7 +640,12 @@ public class ServerPlayer extends Player { + public CraftPlayer.TransferCookieConnection transferCookieConnection; +@@ -679,7 +680,12 @@ public class ServerPlayer extends Player { --this.invulnerableTime; } diff --git a/patches/unapplied/server/0058-Use-UserCache-for-player-heads.patch b/patches/server/0057-Use-UserCache-for-player-heads.patch similarity index 88% rename from patches/unapplied/server/0058-Use-UserCache-for-player-heads.patch rename to patches/server/0057-Use-UserCache-for-player-heads.patch index 48ccece56f..8a33892e11 100644 --- a/patches/unapplied/server/0058-Use-UserCache-for-player-heads.patch +++ b/patches/server/0057-Use-UserCache-for-player-heads.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use UserCache for player heads diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 51e94e6f97a7c75e2281ad751c8e2dbee2e28afd..062594cebbe8cc0a0c94ecf7c8da4ee349a27521 100644 +index 271255fb1daf297d066bcea2a8539b25d2cc0337..d20ae5345d85dee1bcc83a45837d2288a6da49be 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -211,7 +211,13 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { +@@ -202,7 +202,13 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { if (name == null) { this.setProfile(null); } else { diff --git a/patches/unapplied/server/0059-Disable-spigot-tick-limiters.patch b/patches/server/0058-Disable-spigot-tick-limiters.patch similarity index 88% rename from patches/unapplied/server/0059-Disable-spigot-tick-limiters.patch rename to patches/server/0058-Disable-spigot-tick-limiters.patch index 57aa7d7317..862c1b54ff 100644 --- a/patches/unapplied/server/0059-Disable-spigot-tick-limiters.patch +++ b/patches/server/0058-Disable-spigot-tick-limiters.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 673141ab586057b2d05b3921cc4d42b4f5e049ab..3f910b1712c41e91de99ad00a90e0f3081f94deb 100644 +index b638e223c9ac1019fac9d1a8203feac90cfcc724..dac9c71d696a3fd1554408a6beb6840382bbc30c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -708,9 +708,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -700,9 +700,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { boolean flag = this.tickRateManager().runsNormally(); int tilesThisCycle = 0; diff --git a/patches/unapplied/server/0060-Add-PlayerInitialSpawnEvent.patch b/patches/server/0059-Add-PlayerInitialSpawnEvent.patch similarity index 89% rename from patches/unapplied/server/0060-Add-PlayerInitialSpawnEvent.patch rename to patches/server/0059-Add-PlayerInitialSpawnEvent.patch index 2ea1d3a2b7..6f7c11e165 100644 --- a/patches/unapplied/server/0060-Add-PlayerInitialSpawnEvent.patch +++ b/patches/server/0059-Add-PlayerInitialSpawnEvent.patch @@ -12,10 +12,10 @@ improve setPosition to use raw public net.minecraft.world.entity.Entity setRot(FF)V diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 72488b0d499e4e0d0ccba38622cc5a3f88a9e3fa..50ceb120d04c3149dd1cca7908a9ea862b25e5ab 100644 +index e8377a2301e0e6c560a304ecd93dc1f90ee474eb..8f3bcb7183ed09e9c2a16e26b5b3ac125aa57d90 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -228,7 +228,7 @@ public abstract class PlayerList { +@@ -226,7 +226,7 @@ public abstract class PlayerList { // Spigot start - spawn location event Player spawnPlayer = player.getBukkitEntity(); @@ -24,7 +24,7 @@ index 72488b0d499e4e0d0ccba38622cc5a3f88a9e3fa..50ceb120d04c3149dd1cca7908a9ea86 this.cserver.getPluginManager().callEvent(ev); Location loc = ev.getSpawnLocation(); -@@ -236,7 +236,10 @@ public abstract class PlayerList { +@@ -234,7 +234,10 @@ public abstract class PlayerList { player.spawnIn(worldserver1); player.gameMode.setLevel((ServerLevel) player.level()); diff --git a/patches/unapplied/server/0061-Configurable-Disabling-Cat-Chest-Detection.patch b/patches/server/0060-Configurable-Disabling-Cat-Chest-Detection.patch similarity index 88% rename from patches/unapplied/server/0061-Configurable-Disabling-Cat-Chest-Detection.patch rename to patches/server/0060-Configurable-Disabling-Cat-Chest-Detection.patch index 1ebc3875d7..a42f95d79a 100644 --- a/patches/unapplied/server/0061-Configurable-Disabling-Cat-Chest-Detection.patch +++ b/patches/server/0060-Configurable-Disabling-Cat-Chest-Detection.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Configurable Disabling Cat Chest Detection Offers a gameplay feature to stop cats from blocking chests diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java -index 3d153e5c48bc80ec969de9a32113537e03fb812b..305bce4d833116cc21e64fdcdfe13f03e94ff4ba 100644 +index e0033b6a3beafa52f18f3aa3cbc87daa0af681ad..abd33cdfcf7c8851f7191612bcdb377bcdfb922f 100644 --- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java -@@ -364,6 +364,11 @@ public class ChestBlock extends AbstractChestBlock implements +@@ -349,6 +349,11 @@ public class ChestBlock extends AbstractChestBlock implements } private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) { diff --git a/patches/unapplied/server/0062-Improve-Player-chat-API-handling.patch b/patches/server/0061-Improve-Player-chat-API-handling.patch similarity index 89% rename from patches/unapplied/server/0062-Improve-Player-chat-API-handling.patch rename to patches/server/0061-Improve-Player-chat-API-handling.patch index 237217ce6f..1ab7f0117e 100644 --- a/patches/unapplied/server/0062-Improve-Player-chat-API-handling.patch +++ b/patches/server/0061-Improve-Player-chat-API-handling.patch @@ -17,10 +17,10 @@ Co-authored-by: Jake Potrebic Co-authored-by: SoSeDiK diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0b09b4adefdaba43949b1a83dc8f89af147924e9..f7babb4883a45244dd07eab1e87cf5fd4df83d91 100644 +index 4a37313ea0f2253f377ea5d0d2c2d7b66c599ffe..a944eb2b5dbc2a44c32cf9ea794c9b225de16a70 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1930,7 +1930,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2002,7 +2002,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } OutgoingChatMessage outgoing = OutgoingChatMessage.create(original); @@ -29,7 +29,7 @@ index 0b09b4adefdaba43949b1a83dc8f89af147924e9..f7babb4883a45244dd07eab1e87cf5fd this.handleCommand(s); } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Do nothing, this is coming from a plugin -@@ -2017,7 +2017,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2089,7 +2089,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -40,7 +40,7 @@ index 0b09b4adefdaba43949b1a83dc8f89af147924e9..f7babb4883a45244dd07eab1e87cf5fd if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 56a63adc3c0c919594c3f2646d4cf5b86b5c6f1e..5b22714d6f5eb8318275ca0bf01597be8d55f118 100644 +index b43dae6ed6ebdd1978e35e9d43e07591f90dcb09..4a1305df41c42be65dbb0438066e148e0b22aaaf 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -897,7 +897,7 @@ public final class CraftServer implements Server { @@ -53,10 +53,10 @@ index 56a63adc3c0c919594c3f2646d4cf5b86b5c6f1e..5b22714d6f5eb8318275ca0bf01597be if (this.commandMap.dispatch(sender, commandLine)) { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 245f58942b6a69a67fa7ed31121d461e27a98ae0..1d6176714b097d4ab74af345af319e325735c58f 100644 +index 07bfb5014d82262b0c96fc0c8cf52bfa0f67add1..921d43307f9b8a3c0ff211cf8c20b93b8431af15 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -464,7 +464,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -543,7 +543,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (this.getHandle().connection == null) return; diff --git a/patches/unapplied/server/0063-All-chunks-are-slime-spawn-chunks-toggle.patch b/patches/server/0062-All-chunks-are-slime-spawn-chunks-toggle.patch similarity index 89% rename from patches/unapplied/server/0063-All-chunks-are-slime-spawn-chunks-toggle.patch rename to patches/server/0062-All-chunks-are-slime-spawn-chunks-toggle.patch index a5e068d4c4..7735158345 100644 --- a/patches/unapplied/server/0063-All-chunks-are-slime-spawn-chunks-toggle.patch +++ b/patches/server/0062-All-chunks-are-slime-spawn-chunks-toggle.patch @@ -5,10 +5,10 @@ Subject: [PATCH] All chunks are slime spawn chunks toggle diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index 1405c8ba8578d65cc00d807f31b37d6ddc2d1afb..d536df2c23f8cae6bf920a5304d91f10a9902251 100644 +index 172be1f03f77dcc6d57dd9a9316b303c6f9c7175..136ec2413b6fe4680d7f2e903d04c9984b37f4c0 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java -@@ -346,7 +346,7 @@ public class Slime extends Mob implements Enemy { +@@ -342,7 +342,7 @@ public class Slime extends Mob implements Enemy { } ChunkPos chunkcoordintpair = new ChunkPos(pos); @@ -18,7 +18,7 @@ index 1405c8ba8578d65cc00d807f31b37d6ddc2d1afb..d536df2c23f8cae6bf920a5304d91f10 if (random.nextInt(10) == 0 && flag && pos.getY() < 40) { return checkMobSpawnRules(type, world, spawnReason, pos, random); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index d09f0f68031135f86a864e69eb8d65ceddd7a9b1..70999e95116d50de1a7fecdd91bbad0bac2bf1d8 100644 +index ce05946e4fcff7c8151aa1213b18365dab9060f5..1d4587a97e86251982a9df832949a7093b216862 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -217,7 +217,7 @@ public class CraftChunk implements Chunk { diff --git a/patches/unapplied/server/0064-Expose-server-CommandMap.patch b/patches/server/0063-Expose-server-CommandMap.patch similarity index 78% rename from patches/unapplied/server/0064-Expose-server-CommandMap.patch rename to patches/server/0063-Expose-server-CommandMap.patch index 9e0239735d..c930d0feae 100644 --- a/patches/unapplied/server/0064-Expose-server-CommandMap.patch +++ b/patches/server/0063-Expose-server-CommandMap.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose server CommandMap diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5b22714d6f5eb8318275ca0bf01597be8d55f118..6135e8c0669886260afacdaa7405bf55597b17a6 100644 +index 4a1305df41c42be65dbb0438066e148e0b22aaaf..603ad4841151234d3b8e0e6650a44d63ca9ed921 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2124,6 +2124,7 @@ public final class CraftServer implements Server { +@@ -2140,6 +2140,7 @@ public final class CraftServer implements Server { return this.helpMap; } diff --git a/patches/unapplied/server/0065-Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/server/0064-Be-a-bit-more-informative-in-maxHealth-exception.patch similarity index 89% rename from patches/unapplied/server/0065-Be-a-bit-more-informative-in-maxHealth-exception.patch rename to patches/server/0064-Be-a-bit-more-informative-in-maxHealth-exception.patch index 619d3c8665..5c996dd4f7 100644 --- a/patches/unapplied/server/0065-Be-a-bit-more-informative-in-maxHealth-exception.patch +++ b/patches/server/0064-Be-a-bit-more-informative-in-maxHealth-exception.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Be a bit more informative in maxHealth exception diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 68c2825c2d43b3c949cc4b08035b0f5d277f34f2..844a97b0eb396835ec72b4d14c9362a2ea2a8709 100644 +index 5ba556a9b6b59420abd65b17bea72c8f85a3c70a..c6b41aea86dd6c18b25754fa1ffe4d8ab1dd0f75 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -102,7 +102,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -101,7 +101,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public void setHealth(double health) { health = (float) health; diff --git a/patches/server/0065-Player-Tab-List-and-Title-APIs.patch b/patches/server/0065-Player-Tab-List-and-Title-APIs.patch new file mode 100644 index 0000000000..be9bc42470 --- /dev/null +++ b/patches/server/0065-Player-Tab-List-and-Title-APIs.patch @@ -0,0 +1,109 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Techcable +Date: Thu, 3 Mar 2016 02:32:10 -0600 +Subject: [PATCH] Player Tab List and Title APIs + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 921d43307f9b8a3c0ff211cf8c20b93b8431af15..808c6f9c22893eee2b297f354ea2906f22915389 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -383,6 +383,98 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + } + ++ // Paper start ++ @Override ++ public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) { ++ if (header != null) { ++ String headerJson = net.md_5.bungee.chat.ComponentSerializer.toString(header); ++ playerListHeader = net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(headerJson); ++ } else { ++ playerListHeader = null; ++ } ++ ++ if (footer != null) { ++ String footerJson = net.md_5.bungee.chat.ComponentSerializer.toString(footer); ++ playerListFooter = net.kyori.adventure.text.serializer.gson.GsonComponentSerializer.gson().deserialize(footerJson); ++ } else { ++ playerListFooter = null; ++ } ++ ++ updatePlayerListHeaderFooter(); ++ } ++ ++ @Override ++ public void setPlayerListHeaderFooter(BaseComponent header, BaseComponent footer) { ++ this.setPlayerListHeaderFooter(header == null ? null : new BaseComponent[]{header}, ++ footer == null ? null : new BaseComponent[]{footer}); ++ } ++ ++ ++ @Override ++ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ getHandle().connection.send(new ClientboundSetTitlesAnimationPacket(fadeInTicks, stayTicks, fadeOutTicks)); ++ } ++ ++ @Override ++ public void setSubtitle(BaseComponent[] subtitle) { ++ final ClientboundSetSubtitleTextPacket packet = new ClientboundSetSubtitleTextPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(subtitle))); ++ getHandle().connection.send(packet); ++ } ++ ++ @Override ++ public void setSubtitle(BaseComponent subtitle) { ++ setSubtitle(new BaseComponent[]{subtitle}); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent[] title) { ++ final ClientboundSetTitleTextPacket packet = new ClientboundSetTitleTextPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(title))); ++ getHandle().connection.send(packet); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent title) { ++ showTitle(new BaseComponent[]{title}); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent[] title, BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks); ++ setSubtitle(subtitle); ++ showTitle(title); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent title, BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks); ++ setSubtitle(subtitle); ++ showTitle(title); ++ } ++ ++ @Override ++ public void sendTitle(com.destroystokyo.paper.Title title) { ++ Preconditions.checkNotNull(title, "Title is null"); ++ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut()); ++ setSubtitle(title.getSubtitle() == null ? new BaseComponent[0] : title.getSubtitle()); ++ showTitle(title.getTitle()); ++ } ++ ++ @Override ++ public void updateTitle(com.destroystokyo.paper.Title title) { ++ Preconditions.checkNotNull(title, "Title is null"); ++ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut()); ++ if (title.getSubtitle() != null) { ++ setSubtitle(title.getSubtitle()); ++ } ++ showTitle(title.getTitle()); ++ } ++ ++ @Override ++ public void hideTitle() { ++ getHandle().connection.send(new ClientboundClearTitlesPacket(false)); ++ } ++ // Paper end ++ + @Override + public String getDisplayName() { + if(true) return io.papermc.paper.adventure.DisplayNames.getLegacy(this); // Paper diff --git a/patches/unapplied/server/0067-Add-configurable-portal-search-radius.patch b/patches/server/0066-Add-configurable-portal-search-radius.patch similarity index 90% rename from patches/unapplied/server/0067-Add-configurable-portal-search-radius.patch rename to patches/server/0066-Add-configurable-portal-search-radius.patch index df6cdd9f85..41391fe2ae 100644 --- a/patches/unapplied/server/0067-Add-configurable-portal-search-radius.patch +++ b/patches/server/0066-Add-configurable-portal-search-radius.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add configurable portal search radius diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c582d2f447384ca3b46c3b8159b7114d7efef52c..8444518356f32486ee4064446f8c1396276ad015 100644 +index f4e0a10eb936ed9d43c9a2fc3ed03a785bf00901..406d69220b315b47bd3d03a0dacc39addaaf9294 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3192,7 +3192,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -3208,7 +3208,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess double d0 = DimensionType.getTeleportationScale(this.level().dimensionType(), destination.dimensionType()); BlockPos blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0); // CraftBukkit start @@ -24,7 +24,7 @@ index c582d2f447384ca3b46c3b8159b7114d7efef52c..8444518356f32486ee4064446f8c1396 return null; } diff --git a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java -index 550b7bc694d861c084769265f6c49c4d44033296..afdd4ecbff21e2172b390bcbdf74f3c1bbddafcc 100644 +index f4c8eee7bc574d402a7897a202734047e37c7a67..03dd833d61d5152af3032f23dd1fc4c75da9bc4f 100644 --- a/src/main/java/net/minecraft/world/level/portal/PortalForcer.java +++ b/src/main/java/net/minecraft/world/level/portal/PortalForcer.java @@ -43,7 +43,7 @@ public class PortalForcer { diff --git a/patches/unapplied/server/0068-Add-velocity-warnings.patch b/patches/server/0067-Add-velocity-warnings.patch similarity index 92% rename from patches/unapplied/server/0068-Add-velocity-warnings.patch rename to patches/server/0067-Add-velocity-warnings.patch index ad776ec3f5..b52433be2f 100644 --- a/patches/unapplied/server/0068-Add-velocity-warnings.patch +++ b/patches/server/0067-Add-velocity-warnings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add velocity warnings diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 6135e8c0669886260afacdaa7405bf55597b17a6..2b2d0c8ed68eb86812877026a0bb5c4a6389c3d4 100644 +index 603ad4841151234d3b8e0e6650a44d63ca9ed921..8461eb0ad3531cab7aa50226008a960937830fce 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -300,6 +300,7 @@ public final class CraftServer implements Server { +@@ -302,6 +302,7 @@ public final class CraftServer implements Server { public boolean ignoreVanillaPermissions = false; private final List playerView; public int reloadCount; @@ -17,7 +17,7 @@ index 6135e8c0669886260afacdaa7405bf55597b17a6..2b2d0c8ed68eb86812877026a0bb5c4a static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 85d77772b003e56382f8c3b55fc11a9ae1ec535f..1be5c322abcec8ec32b84dec02d386e53cb5e16a 100644 +index f117d32f3606917ad3526c9140ef5e40990ede8c..3390033bbfc8fd0715458e5faa6a65477272a80b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -129,10 +129,40 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -62,7 +62,7 @@ index 85d77772b003e56382f8c3b55fc11a9ae1ec535f..1be5c322abcec8ec32b84dec02d386e5 public double getHeight() { return this.getHandle().getBbHeight(); diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 231b4e3552b17f7803815a433a5ece440c227cc6..4bfc2f1729e45e36307a98bd69de9c820123cb8e 100644 +index e086765dec32241bc5a77afcf072c77a40c6d785..35c90aaee30980610d168c01cbe9abfe04331cb8 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -81,6 +81,17 @@ public class WatchdogThread extends Thread diff --git a/patches/unapplied/server/0069-Configurable-inter-world-teleportation-safety.patch b/patches/server/0068-Configurable-inter-world-teleportation-safety.patch similarity index 91% rename from patches/unapplied/server/0069-Configurable-inter-world-teleportation-safety.patch rename to patches/server/0068-Configurable-inter-world-teleportation-safety.patch index 1b392cb898..0c197f221b 100644 --- a/patches/unapplied/server/0069-Configurable-inter-world-teleportation-safety.patch +++ b/patches/server/0068-Configurable-inter-world-teleportation-safety.patch @@ -16,10 +16,10 @@ The wanted destination was on top of the emerald block however the player ended This only is the case if the player is teleporting between worlds. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5cff1571a4eb1af6c961a265051642234bf1b121..e20cba0126b844b8655a387e4977d79a67ee63df 100644 +index 808c6f9c22893eee2b297f354ea2906f22915389..6ea9ff476b49a778a767336b7650bf3525605fc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1158,7 +1158,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1235,7 +1235,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { entity.connection.teleport(to); } else { // The respawn reason should never be used if the passed location is non null. diff --git a/patches/unapplied/server/0070-Add-exception-reporting-event.patch b/patches/server/0069-Add-exception-reporting-event.patch similarity index 84% rename from patches/unapplied/server/0070-Add-exception-reporting-event.patch rename to patches/server/0069-Add-exception-reporting-event.patch index 76f15e2d28..4157fa5a21 100644 --- a/patches/unapplied/server/0070-Add-exception-reporting-event.patch +++ b/patches/server/0069-Add-exception-reporting-event.patch @@ -49,31 +49,41 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8 + } +} diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -index 8d06e8d286da2573e40794adab695ff77e5afd86..9143ce01650b51e7f6a677c5941ade91a506449f 100644 +index 68551947f5b7d3471f15bd74ccd86519ab34c1c1..a0b0614ac7d2009db5c6c10ab4a5f09dd447c635 100644 --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -@@ -357,6 +357,7 @@ public class OldUsersConverter { +@@ -356,7 +356,11 @@ public class OldUsersConverter { + try { root = NbtIo.readCompressed(new java.io.FileInputStream(file5), NbtAccounter.unlimitedHeap()); } catch (Exception exception) { - exception.printStackTrace(); -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent +- io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper ++ // Paper start ++ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); ++ exception.printStackTrace(); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); ++ // Paper end } if (root != null) { -@@ -370,6 +371,7 @@ public class OldUsersConverter { +@@ -369,7 +373,11 @@ public class OldUsersConverter { + try { NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2)); } catch (Exception exception) { - exception.printStackTrace(); -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent +- io.papermc.paper.util.TraceUtil.printStackTrace(exception); // Paper ++ // Paper start ++ io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(exception); ++ exception.printStackTrace(); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); ++ // Paper end } } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java -index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..2b5b2869589991be37a4f128faabbff50e661470 100644 +index 8183c26b4a5ad169a53702b8c45fd05cda934e80..36dec6cd78a0990ba3c09a4a748c259ef5c0a2ff 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java -@@ -118,6 +118,7 @@ public class VillageSiege implements CustomSpawner { - entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.EVENT, (SpawnGroupData) null, (CompoundTag) null); +@@ -117,6 +117,7 @@ public class VillageSiege implements CustomSpawner { + entityzombie.finalizeSpawn(world, world.getCurrentDifficultyAt(entityzombie.blockPosition()), MobSpawnType.EVENT, (SpawnGroupData) null); } catch (Exception exception) { VillageSiege.LOGGER.warn("Failed to create zombie for village siege at {}", vec3d, exception); + com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - ServerExceptionEvent @@ -81,10 +91,10 @@ index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..2b5b2869589991be37a4f128faabbff5 } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 3f910b1712c41e91de99ad00a90e0f3081f94deb..b91df88036d3ec2579883a9c65a7b80d4c0be81b 100644 +index dac9c71d696a3fd1554408a6beb6840382bbc30c..29fe6aaa9e344a9c373399d63dd63ff0c04cbfda 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -737,6 +737,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -729,6 +729,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // Paper start - Prevent block entity and entity crashes final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ()); MinecraftServer.LOGGER.error(msg, throwable); @@ -93,10 +103,10 @@ index 3f910b1712c41e91de99ad00a90e0f3081f94deb..b91df88036d3ec2579883a9c65a7b80d // Paper end - Prevent block entity and entity crashes } diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index 5d65baba605dd83e5f74d526aeda36d8ede8c014..604766a286d00bb4b40c20482376fe80651beabe 100644 +index 6a80479554f0c860a8dd6baa1a6506858fca83e3..6324689f52363f19501143c1649f0885684cb796 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -@@ -291,6 +291,7 @@ public final class NaturalSpawner { +@@ -274,6 +274,7 @@ public final class NaturalSpawner { NaturalSpawner.LOGGER.warn("Can't spawn entity of type: {}", BuiltInRegistries.ENTITY_TYPE.getKey(type)); } catch (Exception exception) { NaturalSpawner.LOGGER.warn("Failed to create mob", exception); @@ -104,7 +114,7 @@ index 5d65baba605dd83e5f74d526aeda36d8ede8c014..604766a286d00bb4b40c20482376fe80 } return null; -@@ -404,6 +405,7 @@ public final class NaturalSpawner { +@@ -362,6 +363,7 @@ public final class NaturalSpawner { entity = biomesettingsmobs_c.type.create(world.getLevel()); } catch (Exception exception) { NaturalSpawner.LOGGER.warn("Failed to create mob", exception); @@ -113,7 +123,7 @@ index 5d65baba605dd83e5f74d526aeda36d8ede8c014..604766a286d00bb4b40c20482376fe80 } diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index e764eecfb2eea62d641c9444831daae6d50c687e..53c10ed58451c317e6d45f34d6eca3072155b814 100644 +index c4ff77ed93e17ed816e0325eb5bdfcdb444be4a4..60a1828d179c29514813143e3c8e93b08afe9849 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -1,6 +1,7 @@ @@ -145,7 +155,7 @@ index e764eecfb2eea62d641c9444831daae6d50c687e..53c10ed58451c317e6d45f34d6eca307 // CraftBukkit end } } -@@ -1066,6 +1073,7 @@ public class LevelChunk extends ChunkAccess { +@@ -1064,6 +1071,7 @@ public class LevelChunk extends ChunkAccess { // Paper start - Prevent block entity and entity crashes final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); @@ -154,10 +164,10 @@ index e764eecfb2eea62d641c9444831daae6d50c687e..53c10ed58451c317e6d45f34d6eca307 // Paper end - Prevent block entity and entity crashes // Spigot start diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index d9daf07132c46548964a75588b69d7a74680e917..66994aa135037919219e0bbcabe7de9f6f2c9dcd 100644 +index 15f273aa592828719de6e092d79a407dc8652dfe..b24e8255ab18eb5b2e4968aa62aa3d72ef33f0eb 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -274,6 +274,7 @@ public class RegionFile implements AutoCloseable { +@@ -296,6 +296,7 @@ public class RegionFile implements AutoCloseable { return true; } } catch (IOException ioexception) { @@ -165,7 +175,7 @@ index d9daf07132c46548964a75588b69d7a74680e917..66994aa135037919219e0bbcabe7de9f return false; } } -@@ -355,6 +356,7 @@ public class RegionFile implements AutoCloseable { +@@ -377,6 +378,7 @@ public class RegionFile implements AutoCloseable { ((java.nio.Buffer) buf).position(5); // CraftBukkit - decompile error filechannel.write(buf); } catch (Throwable throwable) { diff --git a/patches/unapplied/server/0071-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0070-Disable-Scoreboards-for-non-players-by-default.patch similarity index 72% rename from patches/unapplied/server/0071-Disable-Scoreboards-for-non-players-by-default.patch rename to patches/server/0070-Disable-Scoreboards-for-non-players-by-default.patch index fae95eea55..65cd7d8a7a 100644 --- a/patches/unapplied/server/0071-Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/0070-Disable-Scoreboards-for-non-players-by-default.patch @@ -11,10 +11,10 @@ So avoid looking up scoreboards and short circuit to the "not on a team" logic which is most likely to be true. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8444518356f32486ee4064446f8c1396276ad015..9fb52c98455d547bdde6d56689528e78a5ddfed5 100644 +index 406d69220b315b47bd3d03a0dacc39addaaf9294..1cd40266418a3805f05b09c554d561e2e83822e5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2820,6 +2820,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2836,6 +2836,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @Nullable public PlayerTeam getTeam() { @@ -23,14 +23,14 @@ index 8444518356f32486ee4064446f8c1396276ad015..9fb52c98455d547bdde6d56689528e78 } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 13e8502640abad928282e4b1596f2ad97b4db765..99e91dd930bb33a006b2be3ad678df5861eb8eeb 100644 +index e72ca3af948aa223e6ef31bb0972dd036c8f7c2d..70ac2c957341b363246a9165804471d2668e6492 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -841,6 +841,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - if (nbt.contains("Team", 8)) { +@@ -873,6 +873,7 @@ public abstract class LivingEntity extends Entity implements Attackable { String s = nbt.getString("Team"); - PlayerTeam scoreboardteam = this.level().getScoreboard().getPlayerTeam(s); + Scoreboard scoreboard = this.level().getScoreboard(); + PlayerTeam scoreboardteam = scoreboard.getPlayerTeam(s); + if (!this.level().paperConfig().scoreboards.allowNonPlayerEntitiesOnScoreboards && !(this instanceof net.minecraft.world.entity.player.Player)) { scoreboardteam = null; } // Paper - Perf: Disable Scoreboards for non players by default - boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam); + boolean flag = scoreboardteam != null && scoreboard.addPlayerToTeam(this.getStringUUID(), scoreboardteam); if (!flag) { diff --git a/patches/unapplied/server/0072-Add-methods-for-working-with-arrows-stuck-in-living-.patch b/patches/server/0071-Add-methods-for-working-with-arrows-stuck-in-living-.patch similarity index 90% rename from patches/unapplied/server/0072-Add-methods-for-working-with-arrows-stuck-in-living-.patch rename to patches/server/0071-Add-methods-for-working-with-arrows-stuck-in-living-.patch index 5fb20edd00..aa48fe9119 100644 --- a/patches/unapplied/server/0072-Add-methods-for-working-with-arrows-stuck-in-living-.patch +++ b/patches/server/0071-Add-methods-for-working-with-arrows-stuck-in-living-.patch @@ -7,10 +7,10 @@ Upstream added methods for this, original methods are now deprecated diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 844a97b0eb396835ec72b4d14c9362a2ea2a8709..75dccbdde0d116ef194aa2ced328ad3c3992204e 100644 +index c6b41aea86dd6c18b25754fa1ffe4d8ab1dd0f75..4a2f49be0af5d88e0fe5dd8af00b77dd0da2f208 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -283,10 +283,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -282,10 +282,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } @Override @@ -41,7 +41,7 @@ index 844a97b0eb396835ec72b4d14c9362a2ea2a8709..75dccbdde0d116ef194aa2ced328ad3c @Override public void damage(double amount) { -@@ -815,4 +834,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -800,4 +819,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { this.getHandle().persistentInvisibility = invisible; this.getHandle().setSharedFlag(5, invisible); } diff --git a/patches/unapplied/server/0073-Chunk-Save-Reattempt.patch b/patches/server/0072-Chunk-Save-Reattempt.patch similarity index 86% rename from patches/unapplied/server/0073-Chunk-Save-Reattempt.patch rename to patches/server/0072-Chunk-Save-Reattempt.patch index 2e4356f859..7a39e17bad 100644 --- a/patches/unapplied/server/0073-Chunk-Save-Reattempt.patch +++ b/patches/server/0072-Chunk-Save-Reattempt.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Chunk Save Reattempt We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index 66994aa135037919219e0bbcabe7de9f6f2c9dcd..140d6e455c1729f6e31e95facba5520b75ad838c 100644 +index b24e8255ab18eb5b2e4968aa62aa3d72ef33f0eb..12b7d50f49a2184aaf220a4a50a137b217c57124 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -274,7 +274,7 @@ public class RegionFile implements AutoCloseable { +@@ -296,7 +296,7 @@ public class RegionFile implements AutoCloseable { return true; } } catch (IOException ioexception) { @@ -19,10 +19,10 @@ index 66994aa135037919219e0bbcabe7de9f6f2c9dcd..140d6e455c1729f6e31e95facba5520b } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 1988063a0cac0350ae3b3388b8f2a0c95b8b259f..50a285127ee5a247680d4486ec9d5e01453b8a8e 100644 +index a2879ffb7ec01f7e47e912fc70d9df09527ef902..0697a34875fb807e39f4aae16788fe2455b8138f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -132,6 +132,11 @@ public class RegionFileStorage implements AutoCloseable { +@@ -134,6 +134,11 @@ public class RegionFileStorage implements AutoCloseable { protected void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { RegionFile regionfile = this.getRegionFile(pos, false); // CraftBukkit @@ -34,7 +34,7 @@ index 1988063a0cac0350ae3b3388b8f2a0c95b8b259f..50a285127ee5a247680d4486ec9d5e01 if (nbt == null) { regionfile.clear(pos); -@@ -156,7 +161,18 @@ public class RegionFileStorage implements AutoCloseable { +@@ -158,7 +163,18 @@ public class RegionFileStorage implements AutoCloseable { dataoutputstream.close(); } } diff --git a/patches/unapplied/server/0074-Complete-resource-pack-API.patch b/patches/server/0073-Complete-resource-pack-API.patch similarity index 87% rename from patches/unapplied/server/0074-Complete-resource-pack-API.patch rename to patches/server/0073-Complete-resource-pack-API.patch index 22063b0c12..f7d51505a0 100644 --- a/patches/unapplied/server/0074-Complete-resource-pack-API.patch +++ b/patches/server/0073-Complete-resource-pack-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index c8041492b7b2a1ff67b95d9944cfccd476b3ee1d..66497960995dc30abe60d26200979a78513ff2c6 100644 +index 70a22e140050273ae420e8dc414eab6d08e78617..d0178fc884b57cda9090a80716685994ca1a323e 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -169,7 +169,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -190,7 +190,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack callback.packEventReceived(packet.id(), net.kyori.adventure.resource.ResourcePackStatus.valueOf(packet.action().name()), this.getCraftPlayer()); } // Paper end @@ -22,10 +22,10 @@ index c8041492b7b2a1ff67b95d9944cfccd476b3ee1d..66497960995dc30abe60d26200979a78 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e20cba0126b844b8655a387e4977d79a67ee63df..58c74ad83d17ec47e84a45d33529d88118a34599 100644 +index 6ea9ff476b49a778a767336b7650bf3525605fc0..3d145fb11fa1598b3f31e82445cdc2bbef205dec 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -195,6 +195,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -205,6 +205,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private double healthScale = 20; private CraftWorldBorder clientWorldBorder = null; private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener(); @@ -33,7 +33,7 @@ index e20cba0126b844b8655a387e4977d79a67ee63df..58c74ad83d17ec47e84a45d33529d881 public CraftPlayer(CraftServer server, ServerPlayer entity) { super(server, entity); -@@ -2016,6 +2017,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2083,6 +2084,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper end - adventure diff --git a/patches/unapplied/server/0075-Default-loading-permissions.yml-before-plugins.patch b/patches/server/0074-Default-loading-permissions.yml-before-plugins.patch similarity index 95% rename from patches/unapplied/server/0075-Default-loading-permissions.yml-before-plugins.patch rename to patches/server/0074-Default-loading-permissions.yml-before-plugins.patch index 5cb350113e..339b9641c0 100644 --- a/patches/unapplied/server/0075-Default-loading-permissions.yml-before-plugins.patch +++ b/patches/server/0074-Default-loading-permissions.yml-before-plugins.patch @@ -16,7 +16,7 @@ modify that. Under the previous logic, plugins were unable (cleanly) override pe A config option has been added for those who depend on the previous behavior, but I don't expect that. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2b2d0c8ed68eb86812877026a0bb5c4a6389c3d4..1d85e64b30e872f12de7d84af26be6271e77387e 100644 +index 8461eb0ad3531cab7aa50226008a960937830fce..c9476989d21798713c65b4f0a580bde0a4457c21 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -458,6 +458,7 @@ public final class CraftServer implements Server { diff --git a/patches/unapplied/server/0076-Allow-Reloading-of-Custom-Permissions.patch b/patches/server/0075-Allow-Reloading-of-Custom-Permissions.patch similarity index 90% rename from patches/unapplied/server/0076-Allow-Reloading-of-Custom-Permissions.patch rename to patches/server/0075-Allow-Reloading-of-Custom-Permissions.patch index 78a798eca3..a9c2652319 100644 --- a/patches/unapplied/server/0076-Allow-Reloading-of-Custom-Permissions.patch +++ b/patches/server/0075-Allow-Reloading-of-Custom-Permissions.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions https://github.com/PaperMC/Paper/issues/49 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1d85e64b30e872f12de7d84af26be6271e77387e..f7726d16d37c64228515b0791d921b047bc887e6 100644 +index c9476989d21798713c65b4f0a580bde0a4457c21..99e159386504ab8f3646b08adda12e18686c2641 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2728,5 +2728,23 @@ public final class CraftServer implements Server { +@@ -2751,5 +2751,23 @@ public final class CraftServer implements Server { } return this.adventure$audiences; } diff --git a/patches/unapplied/server/0077-Remove-Metadata-on-reload.patch b/patches/server/0076-Remove-Metadata-on-reload.patch similarity index 93% rename from patches/unapplied/server/0077-Remove-Metadata-on-reload.patch rename to patches/server/0076-Remove-Metadata-on-reload.patch index 006d87514f..cd2cb8fb9c 100644 --- a/patches/unapplied/server/0077-Remove-Metadata-on-reload.patch +++ b/patches/server/0076-Remove-Metadata-on-reload.patch @@ -7,7 +7,7 @@ Metadata is not meant to persist reload as things break badly with non primitive This will remove metadata on reload so it does not crash everything if a plugin uses it. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f7726d16d37c64228515b0791d921b047bc887e6..f69d5e8f22fa8335b19f9e777ddbd33443eb08dc 100644 +index 99e159386504ab8f3646b08adda12e18686c2641..c625ed2039566a1a175a8100fb8a42566f1cfb1a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -964,8 +964,16 @@ public final class CraftServer implements Server { diff --git a/patches/unapplied/server/0078-Handle-Item-Meta-Inconsistencies.patch b/patches/server/0077-Handle-Item-Meta-Inconsistencies.patch similarity index 53% rename from patches/unapplied/server/0078-Handle-Item-Meta-Inconsistencies.patch rename to patches/server/0077-Handle-Item-Meta-Inconsistencies.patch index 279fb52e31..34099553f5 100644 --- a/patches/unapplied/server/0078-Handle-Item-Meta-Inconsistencies.patch +++ b/patches/server/0077-Handle-Item-Meta-Inconsistencies.patch @@ -17,88 +17,82 @@ was added, resulting in 2 different ways to modify an items enchantments. For consistency, the old API methods now forward to use the ItemMeta API equivalents, and should deprecate the old API's. -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 6291265ae4691bf7dffe196d20571c1c30e8d906..70511628eefc28163d07f50f18d9cc55dd93d68b 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -181,6 +181,23 @@ public final class ItemStack { - return this.getItem().getTooltipImage(this); - } +diff --git a/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java b/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java +index b49eb019cce58049c2b3a0e80e3d08998b16f7ea..dd6bf199f22476ef1d0f704883b748be97b0065e 100644 +--- a/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java ++++ b/src/main/java/net/minecraft/world/item/enchantment/ItemEnchantments.java +@@ -27,15 +27,21 @@ import net.minecraft.tags.TagKey; + import net.minecraft.world.item.Item; + import net.minecraft.world.item.TooltipFlag; + import net.minecraft.world.item.component.TooltipProvider; ++// Paper start ++import it.unimi.dsi.fastutil.objects.Object2IntAVLTreeMap; ++// Paper end + public class ItemEnchantments implements TooltipProvider { +- public static final ItemEnchantments EMPTY = new ItemEnchantments(new Object2IntOpenHashMap<>(), true); + // Paper start -+ private static final java.util.Comparator enchantSorter = java.util.Comparator.comparing(o -> o.getString("id")); -+ private void processEnchantOrder(@Nullable CompoundTag tag) { -+ if (tag == null || !tag.contains("Enchantments", net.minecraft.nbt.Tag.TAG_LIST)) { -+ return; -+ } -+ ListTag list = tag.getList("Enchantments", net.minecraft.nbt.Tag.TAG_COMPOUND); -+ if (list.size() < 2) { -+ return; -+ } -+ try { -+ //noinspection unchecked -+ list.sort((java.util.Comparator) enchantSorter); // Paper -+ } catch (Exception ignored) {} -+ } ++ private static final java.util.Comparator> ENCHANTMENT_ORDER = java.util.Comparator.comparing(Holder::getRegisteredName); ++ public static final ItemEnchantments EMPTY = new ItemEnchantments(new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), true); + // Paper end -+ - public ItemStack(ItemLike item) { - this(item, 1); - } -@@ -227,6 +244,7 @@ public final class ItemStack { - this.count = nbttagcompound.getByte("Count"); - if (nbttagcompound.contains("tag", 10)) { - this.tag = nbttagcompound.getCompound("tag").copy(); -+ this.processEnchantOrder(this.tag); // Paper - this.getItem().verifyTagAfterLoad(this.tag); - } + public static final int MAX_LEVEL = 255; + private static final Codec LEVEL_CODEC = Codec.intRange(0, 255); +- private static final Codec>> LEVELS_CODEC = Codec.unboundedMap( ++ private static final Codec>> LEVELS_CODEC = Codec.unboundedMap( // Paper + BuiltInRegistries.ENCHANTMENT.holderByNameCodec(), LEVEL_CODEC + ) +- .xmap(Object2IntOpenHashMap::new, Function.identity()); ++ .xmap(Object2IntAVLTreeMap::new, Function.identity()); // Paper + private static final Codec FULL_CODEC = RecordCodecBuilder.create( + instance -> instance.group( + LEVELS_CODEC.fieldOf("levels").forGetter(component -> component.enchantments), +@@ -45,16 +51,16 @@ public class ItemEnchantments implements TooltipProvider { + ); + public static final Codec CODEC = Codec.withAlternative(FULL_CODEC, LEVELS_CODEC, map -> new ItemEnchantments(map, true)); + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( +- ByteBufCodecs.map(Object2IntOpenHashMap::new, ByteBufCodecs.holderRegistry(Registries.ENCHANTMENT), ByteBufCodecs.VAR_INT), ++ ByteBufCodecs.map((v) -> new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER), ByteBufCodecs.holderRegistry(Registries.ENCHANTMENT), ByteBufCodecs.VAR_INT), // Paper + component -> component.enchantments, + ByteBufCodecs.BOOL, + component -> component.showInTooltip, + ItemEnchantments::new + ); +- final Object2IntOpenHashMap> enchantments; ++ final Object2IntAVLTreeMap> enchantments; // Paper + public final boolean showInTooltip; -@@ -846,6 +864,7 @@ public final class ItemStack { +- ItemEnchantments(Object2IntOpenHashMap> enchantments, boolean showInTooltip) { ++ ItemEnchantments(Object2IntAVLTreeMap> enchantments, boolean showInTooltip) { // Paper + this.enchantments = enchantments; + this.showInTooltip = showInTooltip; - public void setTag(@Nullable CompoundTag nbt) { - this.tag = nbt; -+ this.processEnchantOrder(this.tag); // Paper - if (this.getItem().canBeDepleted()) { - this.setDamageValue(this.getDamageValue()); - } -@@ -1143,6 +1162,7 @@ public final class ItemStack { - ListTag nbttaglist = this.tag.getList("Enchantments", 10); - - nbttaglist.add(EnchantmentHelper.storeEnchantment(EnchantmentHelper.getEnchantmentId(enchantment), (byte) level)); -+ processEnchantOrder(this.tag); // Paper +@@ -145,7 +151,7 @@ public class ItemEnchantments implements TooltipProvider { } - public boolean isEnchanted() { + public static class Mutable { +- private final Object2IntOpenHashMap> enchantments = new Object2IntOpenHashMap<>(); ++ private final Object2IntAVLTreeMap> enchantments = new Object2IntAVLTreeMap<>(ENCHANTMENT_ORDER); // Paper + public boolean showInTooltip; + + public Mutable(ItemEnchantments enchantmentsComponent) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 0bb01e53f1c15071c8cd818cce79af8196fe790f..b59e84bbed37b002a34fe81efdce6f025617fc84 100644 +index 1f99a9b9a0510ab19a5913588d6d677d6cada5e5..09c363f483cb12be01afd9a274c541f3bdeb992c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -192,28 +192,11 @@ public final class CraftItemStack extends ItemStack { +@@ -191,16 +191,11 @@ public final class CraftItemStack extends ItemStack { public void addUnsafeEnchantment(Enchantment ench, int level) { Preconditions.checkArgument(ench != null, "Enchantment cannot be null"); - if (!CraftItemStack.makeTag(this.handle)) { - return; - } -- ListTag list = CraftItemStack.getEnchantmentList(this.handle); +- ItemEnchantments list = CraftItemStack.getEnchantmentList(this.handle); - if (list == null) { -- list = new ListTag(); -- this.handle.getTag().put(ENCHANTMENTS.NBT, list); +- list = ItemEnchantments.EMPTY; - } -- int size = list.size(); -- -- for (int i = 0; i < size; i++) { -- CompoundTag tag = (CompoundTag) list.get(i); -- String id = tag.getString(ENCHANTMENTS_ID.NBT); -- if (ench.getKey().equals(NamespacedKey.fromString(id))) { -- tag.putShort(ENCHANTMENTS_LVL.NBT, (short) level); -- return; -- } -- } -- CompoundTag tag = new CompoundTag(); -- tag.putString(ENCHANTMENTS_ID.NBT, ench.getKey().toString()); -- tag.putShort(ENCHANTMENTS_LVL.NBT, (short) level); -- list.add(tag); +- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list); +- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), level); +- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable()); + // Paper start - Replace whole method + final ItemMeta itemMeta = this.getItemMeta(); + itemMeta.addEnchant(ench, level, true); @@ -107,45 +101,23 @@ index 0bb01e53f1c15071c8cd818cce79af8196fe790f..b59e84bbed37b002a34fe81efdce6f02 } static boolean makeTag(net.minecraft.world.item.ItemStack item) { -@@ -246,43 +229,15 @@ public final class CraftItemStack extends ItemStack { +@@ -229,24 +224,15 @@ public final class CraftItemStack extends ItemStack { public int removeEnchantment(Enchantment ench) { Preconditions.checkArgument(ench != null, "Enchantment cannot be null"); -- ListTag list = CraftItemStack.getEnchantmentList(this.handle), listCopy; +- ItemEnchantments list = CraftItemStack.getEnchantmentList(this.handle); - if (list == null) { - return 0; - } -- int index = Integer.MIN_VALUE; -- int level = Integer.MIN_VALUE; -- int size = list.size(); -- -- for (int i = 0; i < size; i++) { -- CompoundTag enchantment = (CompoundTag) list.get(i); -- String id = enchantment.getString(ENCHANTMENTS_ID.NBT); -- if (ench.getKey().equals(NamespacedKey.fromString(id))) { -- index = i; -- level = 0xffff & enchantment.getShort(ENCHANTMENTS_LVL.NBT); -- break; -- } -- } -- -- if (index == Integer.MIN_VALUE) { +- int level = this.getEnchantmentLevel(ench); +- if (level <= 0) { - return 0; - } -- if (size == 1) { -- this.handle.getTag().remove(ENCHANTMENTS.NBT); -- if (this.handle.getTag().isEmpty()) { -- this.handle.setTag(null); -- } -- return level; -- } +- int size = list.size(); - -- // This is workaround for not having an index removal -- listCopy = new ListTag(); -- for (int i = 0; i < size; i++) { -- if (i != index) { -- listCopy.add(list.get(i)); -- } +- if (size == 1) { +- this.handle.remove(DataComponents.ENCHANTMENTS); +- return level; + // Paper start - replace entire method + int level = getEnchantmentLevel(ench); + if (level > 0) { @@ -154,12 +126,15 @@ index 0bb01e53f1c15071c8cd818cce79af8196fe790f..b59e84bbed37b002a34fe81efdce6f02 + itemMeta.removeEnchant(ench); + this.setItemMeta(itemMeta); } -- this.handle.getTag().put(ENCHANTMENTS.NBT, listCopy); +- +- ItemEnchantments.Mutable listCopy = new ItemEnchantments.Mutable(list); +- listCopy.set(CraftEnchantment.bukkitToMinecraft(ench), -1); // Negative to remove +- this.handle.set(DataComponents.ENCHANTMENTS, listCopy.toImmutable()); + // Paper end return level; } -@@ -294,7 +249,7 @@ public final class CraftItemStack extends ItemStack { +@@ -258,7 +244,7 @@ public final class CraftItemStack extends ItemStack { @Override public Map getEnchantments() { @@ -169,7 +144,7 @@ index 0bb01e53f1c15071c8cd818cce79af8196fe790f..b59e84bbed37b002a34fe81efdce6f02 static Map getEnchantments(net.minecraft.world.item.ItemStack item) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index ffdea312f93d00289364ef4d41a820cd1338f3bd..361268bcc0197c2f9f4bd065d8f7b51771d562a9 100644 +index 04a1c602a1d94f1b84cbeaa3abf90b8fcc31e89f..54e3059f405de2e6306cea16d045fb448bb5b099 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList; @@ -180,41 +155,32 @@ index ffdea312f93d00289364ef4d41a820cd1338f3bd..361268bcc0197c2f9f4bd065d8f7b517 import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import com.google.common.collect.SetMultimap; -@@ -23,6 +24,7 @@ import java.util.ArrayList; - import java.util.Arrays; +@@ -22,6 +23,7 @@ import java.util.Arrays; import java.util.Base64; import java.util.Collection; + import java.util.Collections; +import java.util.Comparator; // Paper import java.util.EnumSet; import java.util.HashMap; import java.util.Iterator; -@@ -33,6 +35,7 @@ import java.util.Map; - import java.util.NoSuchElementException; +@@ -32,6 +34,7 @@ import java.util.Map; import java.util.Objects; + import java.util.Optional; import java.util.Set; +import java.util.TreeMap; // Paper import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nonnull; -@@ -277,7 +280,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - private List lore; // null and empty are two different states internally +@@ -221,7 +224,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + private List lore; // null and empty are two different states internally private Integer customModelData; - private CompoundTag blockData; + private Map blockData; - private Map enchantments; + private EnchantmentMap enchantments; // Paper private Multimap attributeModifiers; private int repairCost; private int hideFlag; -@@ -288,7 +291,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); - - private CompoundTag internalTag; -- final Map unhandledTags = new HashMap(); // Visible for testing only -+ final Map unhandledTags = new TreeMap(); // Visible for testing only // Paper - private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftMetaItem.DATA_TYPE_REGISTRY); - - private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only -@@ -309,7 +312,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -260,7 +263,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.blockData = meta.blockData; if (meta.enchantments != null) { @@ -223,24 +189,19 @@ index ffdea312f93d00289364ef4d41a820cd1338f3bd..361268bcc0197c2f9f4bd065d8f7b517 } if (meta.hasAttributeModifiers()) { -@@ -392,13 +395,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -385,8 +388,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } -- static Map buildEnchantments(CompoundTag tag, ItemMetaKey key) { -+ static EnchantmentMap buildEnchantments(CompoundTag tag, ItemMetaKey key) { // Paper - if (!tag.contains(key.NBT)) { - return null; - } - - ListTag ench = tag.getList(key.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND); -- Map enchantments = new LinkedHashMap(ench.size()); +- static Map buildEnchantments(ItemEnchantments tag) { +- Map enchantments = new LinkedHashMap(tag.size()); ++ static EnchantmentMap buildEnchantments(ItemEnchantments tag) { // Paper + EnchantmentMap enchantments = new EnchantmentMap(); // Paper - for (int i = 0; i < ench.size(); i++) { - String id = ((CompoundTag) ench.get(i)).getString(CraftMetaItem.ENCHANTMENTS_ID.NBT); -@@ -551,13 +554,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - } + tag.entrySet().forEach((entry) -> { + Holder id = entry.getKey(); +@@ -640,13 +643,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + return modifiers; } - static Map buildEnchantments(Map map, ItemMetaKey key) { @@ -255,7 +216,7 @@ index ffdea312f93d00289364ef4d41a820cd1338f3bd..361268bcc0197c2f9f4bd065d8f7b517 for (Map.Entry entry : ench.entrySet()) { // Doctor older enchants String enchantKey = entry.getKey().toString(); -@@ -845,14 +848,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -951,14 +954,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public Map getEnchants() { @@ -272,7 +233,7 @@ index ffdea312f93d00289364ef4d41a820cd1338f3bd..361268bcc0197c2f9f4bd065d8f7b517 } if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { -@@ -1269,7 +1272,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1492,7 +1495,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { clone.customModelData = this.customModelData; clone.blockData = this.blockData; if (this.enchantments != null) { @@ -281,9 +242,9 @@ index ffdea312f93d00289364ef4d41a820cd1338f3bd..361268bcc0197c2f9f4bd065d8f7b517 } if (this.hasAttributeModifiers()) { clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); -@@ -1516,4 +1519,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - return CraftMetaItem.HANDLED_TAGS; - } +@@ -1805,4 +1808,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + + return (result != null) ? result : Optional.empty(); } + + // Paper start diff --git a/patches/unapplied/server/0079-Configurable-Non-Player-Arrow-Despawn-Rate.patch b/patches/server/0078-Configurable-Non-Player-Arrow-Despawn-Rate.patch similarity index 89% rename from patches/unapplied/server/0079-Configurable-Non-Player-Arrow-Despawn-Rate.patch rename to patches/server/0078-Configurable-Non-Player-Arrow-Despawn-Rate.patch index 8e51094c58..e9a2a02b12 100644 --- a/patches/unapplied/server/0079-Configurable-Non-Player-Arrow-Despawn-Rate.patch +++ b/patches/server/0078-Configurable-Non-Player-Arrow-Despawn-Rate.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Configurable Non Player Arrow Despawn Rate Can set a much shorter despawn rate for arrows that players can not pick up. diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index fb68ed6db051577488b209d51f65db7267324751..c210ae3795b1bbaefbe84a6f62b9d3dd75d642a4 100644 +index 94f6b097a2c29fd00d6a670c5bb35fb4ade23d2e..efcfbcb3dc352c9015cc9121dc8d98e8deed8bfd 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -@@ -320,7 +320,7 @@ public abstract class AbstractArrow extends Projectile { +@@ -332,7 +332,7 @@ public abstract class AbstractArrow extends Projectile { protected void tickDespawn() { ++this.life; diff --git a/patches/unapplied/server/0080-Add-World-Util-Methods.patch b/patches/server/0079-Add-World-Util-Methods.patch similarity index 91% rename from patches/unapplied/server/0080-Add-World-Util-Methods.patch rename to patches/server/0079-Add-World-Util-Methods.patch index 80106855ae..281c7f2bd8 100644 --- a/patches/unapplied/server/0080-Add-World-Util-Methods.patch +++ b/patches/server/0079-Add-World-Util-Methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index b91df88036d3ec2579883a9c65a7b80d4c0be81b..2ad3c16bf36972ff55269612f02cdb4f558f35b7 100644 +index 29fe6aaa9e344a9c373399d63dd63ff0c04cbfda..0e0ab7b2790c1b7540eeb27eb17099e39a6099d4 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -347,6 +347,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -341,6 +341,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return chunk == null ? null : chunk.getFluidState(blockposition); } diff --git a/patches/unapplied/server/0081-Custom-replacement-for-eaten-items.patch b/patches/server/0080-Custom-replacement-for-eaten-items.patch similarity index 90% rename from patches/unapplied/server/0081-Custom-replacement-for-eaten-items.patch rename to patches/server/0080-Custom-replacement-for-eaten-items.patch index fe631ab089..46944191ba 100644 --- a/patches/unapplied/server/0081-Custom-replacement-for-eaten-items.patch +++ b/patches/server/0080-Custom-replacement-for-eaten-items.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Custom replacement for eaten items diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 99e91dd930bb33a006b2be3ad678df5861eb8eeb..13438b60bb3891e40bf0b5e942e0b2ba744121f9 100644 +index 70ac2c957341b363246a9165804471d2668e6492..53da8935e076d56f0a5423e5c1bdcdddc7cbd882 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3719,10 +3719,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3802,10 +3802,11 @@ public abstract class LivingEntity extends Entity implements Attackable { this.triggerItemUseEffects(this.useItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; @@ -21,7 +21,7 @@ index 99e91dd930bb33a006b2be3ad678df5861eb8eeb..13438b60bb3891e40bf0b5e942e0b2ba this.level().getCraftServer().getPluginManager().callEvent(event); if (event.isCancelled()) { -@@ -3736,6 +3737,12 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3819,6 +3820,12 @@ public abstract class LivingEntity extends Entity implements Attackable { } else { itemstack = this.useItem.finishUsingItem(this.level(), this); } @@ -34,7 +34,7 @@ index 99e91dd930bb33a006b2be3ad678df5861eb8eeb..13438b60bb3891e40bf0b5e942e0b2ba // CraftBukkit end if (itemstack != this.useItem) { -@@ -3743,6 +3750,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3826,6 +3833,11 @@ public abstract class LivingEntity extends Entity implements Attackable { } this.stopUsingItem(); diff --git a/patches/unapplied/server/0082-handle-NaN-health-absorb-values-and-repair-bad-data.patch b/patches/server/0081-handle-NaN-health-absorb-values-and-repair-bad-data.patch similarity index 85% rename from patches/unapplied/server/0082-handle-NaN-health-absorb-values-and-repair-bad-data.patch rename to patches/server/0081-handle-NaN-health-absorb-values-and-repair-bad-data.patch index 6aab455065..c8abe59db5 100644 --- a/patches/unapplied/server/0082-handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/patches/server/0081-handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -5,10 +5,10 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 13438b60bb3891e40bf0b5e942e0b2ba744121f9..8447a47e1c493001ea9f54392e02f14da14cb25d 100644 +index 53da8935e076d56f0a5423e5c1bdcdddc7cbd882..f02b12f3853bf4bf29b59a505f06cb98bddb40ff 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -802,7 +802,13 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -833,7 +833,13 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public void readAdditionalSaveData(CompoundTag nbt) { @@ -23,7 +23,7 @@ index 13438b60bb3891e40bf0b5e942e0b2ba744121f9..8447a47e1c493001ea9f54392e02f14d if (nbt.contains("Attributes", 9) && this.level() != null && !this.level().isClientSide) { this.getAttributes().load(nbt.getList("Attributes", 10)); } -@@ -1352,6 +1358,10 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1365,6 +1371,10 @@ public abstract class LivingEntity extends Entity implements Attackable { } public void setHealth(float health) { @@ -34,7 +34,7 @@ index 13438b60bb3891e40bf0b5e942e0b2ba744121f9..8447a47e1c493001ea9f54392e02f14d // CraftBukkit start - Handle scaled health if (this instanceof ServerPlayer) { org.bukkit.craftbukkit.entity.CraftPlayer player = ((ServerPlayer) this).getBukkitEntity(); -@@ -3552,7 +3562,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3637,7 +3647,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } public final void setAbsorptionAmount(float absorptionAmount) { @@ -44,10 +44,10 @@ index 13438b60bb3891e40bf0b5e942e0b2ba744121f9..8447a47e1c493001ea9f54392e02f14d protected void internalSetAbsorptionAmount(float absorptionAmount) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 58c74ad83d17ec47e84a45d33529d88118a34599..02cabe9b5e413ce58b82061ea0347fc7a7ce6866 100644 +index 3d145fb11fa1598b3f31e82445cdc2bbef205dec..37bf685ee6a01a32d369f0154e7b2446c58efd4c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2260,6 +2260,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2327,6 +2327,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setRealHealth(double health) { diff --git a/patches/unapplied/server/0083-Use-a-Shared-Random-for-Entities.patch b/patches/server/0082-Use-a-Shared-Random-for-Entities.patch similarity index 90% rename from patches/unapplied/server/0083-Use-a-Shared-Random-for-Entities.patch rename to patches/server/0082-Use-a-Shared-Random-for-Entities.patch index cec2d61d7d..8be701d5d4 100644 --- a/patches/unapplied/server/0083-Use-a-Shared-Random-for-Entities.patch +++ b/patches/server/0082-Use-a-Shared-Random-for-Entities.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use a Shared Random for Entities Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9fb52c98455d547bdde6d56689528e78a5ddfed5..52220795bf8a73c63837b4e07b1abf99c0344322 100644 +index 1cd40266418a3805f05b09c554d561e2e83822e5..bc098b6a9c0e3b19b9154ab3727949232bddb20a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -166,6 +166,79 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -169,6 +169,79 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } @@ -89,7 +89,7 @@ index 9fb52c98455d547bdde6d56689528e78a5ddfed5..52220795bf8a73c63837b4e07b1abf99 private CraftEntity bukkitEntity; public CraftEntity getBukkitEntity() { -@@ -362,7 +435,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -364,7 +437,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.bb = Entity.INITIAL_AABB; this.stuckSpeedMultiplier = Vec3.ZERO; this.nextStep = 1.0F; @@ -99,10 +99,10 @@ index 9fb52c98455d547bdde6d56689528e78a5ddfed5..52220795bf8a73c63837b4e07b1abf99 this.fluidHeight = new Object2DoubleArrayMap(2); this.fluidOnEyes = new HashSet(); diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java -index d404cd4c805442004d9a5f259a9e0907758ad915..36506dc4b99f9de19a23a99c1bccdcb4e7102e72 100644 +index a98c7d9bf8dbaf9df51551fe66f7927798e9670f..43b4ea96c5c4a6234e5b83d41db9b85c1fe27b8f 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java -@@ -44,7 +44,7 @@ public class Squid extends WaterAnimal { +@@ -42,7 +42,7 @@ public class Squid extends WaterAnimal { public Squid(EntityType type, Level world) { super(type, world); diff --git a/patches/unapplied/server/0084-Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/0083-Configurable-spawn-chances-for-skeleton-horses.patch similarity index 90% rename from patches/unapplied/server/0084-Configurable-spawn-chances-for-skeleton-horses.patch rename to patches/server/0083-Configurable-spawn-chances-for-skeleton-horses.patch index e950cd8144..2307dac98d 100644 --- a/patches/unapplied/server/0084-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/patches/server/0083-Configurable-spawn-chances-for-skeleton-horses.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5a20dc552423717f91178068dc5f8a30be13ea54..ea4eacf66651798185e1c445979a465e173571d0 100644 +index a9d03ee785ca9bc593dce35a7dd681d06f58fb70..6ccc339b8a82c25ba382f1a5609b50cf68f03021 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -614,7 +614,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -620,7 +620,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (this.isRainingAt(blockposition)) { DifficultyInstance difficultydamagescaler = this.getCurrentDifficultyAt(blockposition); diff --git a/patches/unapplied/server/0085-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/patches/server/0084-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch similarity index 82% rename from patches/unapplied/server/0085-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch rename to patches/server/0084-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 9b57bfc36a..f69e8a86d5 100644 --- a/patches/unapplied/server/0085-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/patches/server/0084-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -6,22 +6,22 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 638ab8ee2a44445baee91ee7e63b96ce6c098ad0..cc48cb8c4863db3cb2eb2b4317384fe7e4180ed9 100644 +index b5f305c7d0972438a686d9b3a022156e39b130a2..d5b5eb914278fbd85921c039a8da3492dcbd6168 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1457,6 +1457,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Paper - BlockPhysicsEvent this.profiler.push(() -> { - return worldserver + " " + worldserver.dimension().location(); + String s = String.valueOf(worldserver); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ea4eacf66651798185e1c445979a465e173571d0..1c3b12692094c1eaa086ebb2f060b22aaf9d9b39 100644 +index 6ccc339b8a82c25ba382f1a5609b50cf68f03021..a1e187d2eef9a5dfa41657a90a95ed392c2a919c 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -221,6 +221,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -226,6 +226,7 @@ public class ServerLevel extends Level implements WorldGenLevel { // CraftBukkit start public final LevelStorageSource.LevelStorageAccess convertable; public final UUID uuid; @@ -30,10 +30,10 @@ index ea4eacf66651798185e1c445979a465e173571d0..1c3b12692094c1eaa086ebb2f060b22a public LevelChunk getChunkIfLoaded(int x, int z) { return this.chunkSource.getChunk(x, z, false); diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 2ad3c16bf36972ff55269612f02cdb4f558f35b7..424377f062c6443460a9814feb8b90e7bef71c6a 100644 +index 0e0ab7b2790c1b7540eeb27eb17099e39a6099d4..2a7d2eea46e05d85ce3e72a69dfd26a671a882ac 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -497,7 +497,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -491,7 +491,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit start iblockdata1.updateIndirectNeighbourShapes(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam CraftWorld world = ((ServerLevel) this).getWorld(); @@ -43,11 +43,11 @@ index 2ad3c16bf36972ff55269612f02cdb4f558f35b7..424377f062c6443460a9814feb8b90e7 this.getCraftServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/world/level/block/BushBlock.java b/src/main/java/net/minecraft/world/level/block/BushBlock.java -index 1d46dd41b51a449ed8e032e36e65aad8043fba56..bed3d9c781c7d3ca260027b4737970889a54689c 100644 +index 75109c79daa724340268438725bbf6d39b955691..a7b4b5600e3c889c69ac22294899713d50b5fe5c 100644 --- a/src/main/java/net/minecraft/world/level/block/BushBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BushBlock.java @@ -28,7 +28,7 @@ public abstract class BushBlock extends Block { - public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { // CraftBukkit start if (!state.canSurvive(world, pos)) { - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, pos).isCancelled()) { @@ -56,7 +56,7 @@ index 1d46dd41b51a449ed8e032e36e65aad8043fba56..bed3d9c781c7d3ca260027b473797088 } } diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java -index db67c85810cd42e1c9dee96e8b51d194393c1eb7..0f0750f8c790d0db72a0e6b277449a1461674890 100644 +index cb76568cd1f97024c7a40328d9d72dd8a3e72e8b..7fdf744a2be55313cc75c1322f6534f55cf463f5 100644 --- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java @@ -102,7 +102,7 @@ public class DoublePlantBlock extends BushBlock { diff --git a/patches/unapplied/server/0086-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0085-Entity-AddTo-RemoveFrom-World-Events.patch similarity index 84% rename from patches/unapplied/server/0086-Entity-AddTo-RemoveFrom-World-Events.patch rename to patches/server/0085-Entity-AddTo-RemoveFrom-World-Events.patch index 5c270f17c5..669cb0f4a5 100644 --- a/patches/unapplied/server/0086-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0085-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 1c3b12692094c1eaa086ebb2f060b22aaf9d9b39..211f785adf6b8bfc6b974da7898cb2f4359626c9 100644 +index a1e187d2eef9a5dfa41657a90a95ed392c2a919c..5fa72cda0a7f350082c6fb00cac49c94dcef59d4 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2161,6 +2161,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2185,6 +2185,7 @@ public class ServerLevel extends Level implements WorldGenLevel { entity.setOrigin(entity.getOriginVector().toLocation(getWorld())); } // Paper end - Entity origin API @@ -16,7 +16,7 @@ index 1c3b12692094c1eaa086ebb2f060b22aaf9d9b39..211f785adf6b8bfc6b974da7898cb2f4 } public void onTrackingEnd(Entity entity) { -@@ -2236,6 +2237,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -2255,6 +2256,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } // CraftBukkit end diff --git a/patches/unapplied/server/0087-Configurable-Chunk-Inhabited-Time.patch b/patches/server/0086-Configurable-Chunk-Inhabited-Time.patch similarity index 88% rename from patches/unapplied/server/0087-Configurable-Chunk-Inhabited-Time.patch rename to patches/server/0086-Configurable-Chunk-Inhabited-Time.patch index e803f0aa2e..5c8f105ea5 100644 --- a/patches/unapplied/server/0087-Configurable-Chunk-Inhabited-Time.patch +++ b/patches/server/0086-Configurable-Chunk-Inhabited-Time.patch @@ -11,10 +11,10 @@ For people who want all chunks to be treated equally, you can chose a fixed valu This allows to fine-tune vanilla gameplay. diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 53c10ed58451c317e6d45f34d6eca3072155b814..82b59b7c791216aaaaaaf2972f47bd21dac7a202 100644 +index 60a1828d179c29514813143e3c8e93b08afe9849..963d86e7505e4d9c3854d35d9b59aed3369e8a57 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -@@ -270,6 +270,13 @@ public class LevelChunk extends ChunkAccess { +@@ -272,6 +272,13 @@ public class LevelChunk extends ChunkAccess { return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks); } diff --git a/patches/unapplied/server/0088-EntityPathfindEvent.patch b/patches/server/0087-EntityPathfindEvent.patch similarity index 97% rename from patches/unapplied/server/0088-EntityPathfindEvent.patch rename to patches/server/0087-EntityPathfindEvent.patch index 2fcac51f76..e29cff85e6 100644 --- a/patches/unapplied/server/0088-EntityPathfindEvent.patch +++ b/patches/server/0087-EntityPathfindEvent.patch @@ -19,7 +19,7 @@ index d3a279a1a14f99aee8dd516552e5c60de92b4969..a3e0c5af4cc9323c02e88e768cbda9e4 @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java -index bd38ff5615bbf33b374283e3d461981b30035bb8..74ae984ac41bcdd2cc45f1bec461cdc5f69977c6 100644 +index f1a63db8dac13efcfd73b59c7074f6817cc5dbde..62634bedd97c5be9ecce24ab0cff205715a68da8 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java @@ -41,7 +41,7 @@ public class GroundPathNavigation extends PathNavigation { @@ -67,7 +67,7 @@ index bd38ff5615bbf33b374283e3d461981b30035bb8..74ae984ac41bcdd2cc45f1bec461cdc5 private int getSurfaceY() { diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index c3e1fa25b03c24c9127441d62142a96e5f81f18c..fa5088945adc5e41e34cc2dc21a1762d106254c8 100644 +index 92addc1d3e7d0630c5db76e2a00d61b95b1430cc..21bbc98b26b270b3ad6a3b34d6e50dfb796c3d5a 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -109,7 +109,13 @@ public abstract class PathNavigation { diff --git a/patches/unapplied/server/0089-Sanitise-RegionFileCache-and-make-configurable.patch b/patches/server/0088-Sanitise-RegionFileCache-and-make-configurable.patch similarity index 89% rename from patches/unapplied/server/0089-Sanitise-RegionFileCache-and-make-configurable.patch rename to patches/server/0088-Sanitise-RegionFileCache-and-make-configurable.patch index 23c86e3bd0..eeb14ca415 100644 --- a/patches/unapplied/server/0089-Sanitise-RegionFileCache-and-make-configurable.patch +++ b/patches/server/0088-Sanitise-RegionFileCache-and-make-configurable.patch @@ -11,10 +11,10 @@ The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap). The maximum size of the RegionFileCache is also made configurable. diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 50a285127ee5a247680d4486ec9d5e01453b8a8e..b5b7b73048eaadfe58961631427da7574d42f5e8 100644 +index 0697a34875fb807e39f4aae16788fe2455b8138f..9748b798f55ee0cbfdce1a2b2c48700623ef17a5 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -37,7 +37,7 @@ public class RegionFileStorage implements AutoCloseable { +@@ -39,7 +39,7 @@ public class RegionFileStorage implements AutoCloseable { if (regionfile != null) { return regionfile; } else { diff --git a/patches/server/0089-Do-not-load-chunks-for-Pathfinding.patch b/patches/server/0089-Do-not-load-chunks-for-Pathfinding.patch new file mode 100644 index 0000000000..6e06398919 --- /dev/null +++ b/patches/server/0089-Do-not-load-chunks-for-Pathfinding.patch @@ -0,0 +1,24 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 31 Mar 2016 19:17:58 -0400 +Subject: [PATCH] Do not load chunks for Pathfinding + + +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +index 6a8f44600a426041e3974aa52bdec0cc35e26591..881f41899075be32237d508fc2c38998e61a5a25 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +@@ -478,7 +478,12 @@ public class WalkNodeEvaluator extends NodeEvaluator { + } + + protected static PathType getPathTypeFromState(BlockGetter world, BlockPos pos) { +- BlockState blockState = world.getBlockState(pos); ++ // Paper start - Do not load chunks during pathfinding ++ BlockState blockState = world.getBlockStateIfLoaded(pos); ++ if (blockState == null) { ++ return BlockPathTypes.BLOCKED; ++ } ++ // Paper end + Block block = blockState.getBlock(); + if (blockState.isAir()) { + return PathType.OPEN; diff --git a/patches/unapplied/server/0091-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0090-Add-PlayerUseUnknownEntityEvent.patch similarity index 88% rename from patches/unapplied/server/0091-Add-PlayerUseUnknownEntityEvent.patch rename to patches/server/0090-Add-PlayerUseUnknownEntityEvent.patch index 17e4ac1435..2e6b997c57 100644 --- a/patches/unapplied/server/0091-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/server/0090-Add-PlayerUseUnknownEntityEvent.patch @@ -9,10 +9,10 @@ virtual entities/entities that are not actually known to the server. Co-authored-by: Nassim Jahnke diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java -index b1bc671490329379e0a61466c13ca88c49259721..3a377e887989f591c671fec31208255252b58a78 100644 +index 1e9c68cd1868d083e6a790d56006dd4aa432010a..8a0ee9564fc36a2badf1357f7e6c47b5f1500f6c 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java -@@ -167,4 +167,14 @@ public class ServerboundInteractPacket implements Packet diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -index 3ce4bb344dbb8b50ef4041801e034e79f0b0d19d..66106b821d7a384a2eb0f27993beb9f4257e6815 100644 +index a88aa3150552cea020589dd9fabf0535cec816bc..529f9f57249bd1ffa2698da76ffa9d4a284088db 100644 --- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java -@@ -92,6 +92,8 @@ public class FarmBlock extends Block { +@@ -93,6 +93,8 @@ public class FarmBlock extends Block { @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { int i = (Integer) state.getValue(FarmBlock.MOISTURE); + if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks + if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks @@ -22,22 +22,14 @@ index 3ce4bb344dbb8b50ef4041801e034e79f0b0d19d..66106b821d7a384a2eb0f27993beb9f4 if (!FarmBlock.isNearWater(world, pos) && !world.isRainingAt(pos.above())) { if (i > 0) { diff --git a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java -index 65db2229dae0547c7a3e2847bba7b1a1795ce30f..4e2e80006bd4edae227af7be5ca8e3284b7494f6 100644 +index 7a47a3c9a56bcd3c1e817c6a7db8db8465c484e1..5a39e8d359dc13383711e49ffb2d1294dad26192 100644 --- a/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SpreadingSnowyDirtBlock.java -@@ -3,6 +3,7 @@ package net.minecraft.world.level.block; - import com.mojang.serialization.MapCodec; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; -+import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.tags.FluidTags; - import net.minecraft.util.RandomSource; -@@ -43,6 +44,7 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock { +@@ -43,6 +43,7 @@ public abstract class SpreadingSnowyDirtBlock extends SnowyDirtBlock { @Override - public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { -+ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { ++ if (this instanceof GrassBlock && world.paperConfig().tickRates.grassSpread != 1 && (world.paperConfig().tickRates.grassSpread < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.grassSpread != 0)) { return; } // Paper - Configurable random tick rates for blocks if (!SpreadingSnowyDirtBlock.canBeGrass(state, world, pos)) { // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.DIRT.defaultBlockState()).isCancelled()) { diff --git a/patches/unapplied/server/0093-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/patches/server/0092-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch similarity index 82% rename from patches/unapplied/server/0093-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch rename to patches/server/0092-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 5156c9a9c6..6a8d3ae346 100644 --- a/patches/unapplied/server/0093-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/patches/server/0092-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 211f785adf6b8bfc6b974da7898cb2f4359626c9..c9c711398cf90fc1990a0145196fa05894f9ffff 100644 +index 5fa72cda0a7f350082c6fb00cac49c94dcef59d4..d23a2cfeddf7ef9d10b0b12e0425df759e1fd080 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1384,6 +1384,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1391,6 +1391,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void updateNeighborsAt(BlockPos pos, Block sourceBlock) { diff --git a/patches/unapplied/server/0094-Optimize-DataBits.patch b/patches/server/0093-Optimize-DataBits.patch similarity index 100% rename from patches/unapplied/server/0094-Optimize-DataBits.patch rename to patches/server/0093-Optimize-DataBits.patch diff --git a/patches/unapplied/server/0095-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/patches/server/0094-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch similarity index 100% rename from patches/unapplied/server/0095-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch rename to patches/server/0094-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch diff --git a/patches/unapplied/server/0096-Configurable-Player-Collision.patch b/patches/server/0095-Configurable-Player-Collision.patch similarity index 83% rename from patches/unapplied/server/0096-Configurable-Player-Collision.patch rename to patches/server/0095-Configurable-Player-Collision.patch index 8f62962182..0b8ca4a2d8 100644 --- a/patches/unapplied/server/0096-Configurable-Player-Collision.patch +++ b/patches/server/0095-Configurable-Player-Collision.patch @@ -5,23 +5,23 @@ Subject: [PATCH] Configurable Player Collision diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -index f767bc67fb2b63e0476771b7caabc702ce05c800..0f05f1c2a30fef68ae635f4a2476b8cd1b6a127d 100644 +index 9a1a961eabd4362c171da78c6be82c867f3696a4..1d0c473442b5c72245c356054440323e3c5d4711 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -@@ -198,7 +198,7 @@ public class ClientboundSetPlayerTeamPacket implements Packet playersByName = new java.util.HashMap<>(); @@ -54,7 +54,7 @@ index 50ceb120d04c3149dd1cca7908a9ea862b25e5ab..e1d9f11a9d5333811fc8cb5dd95c0ca7 public PlayerList(MinecraftServer server, LayeredRegistryAccess registryManager, PlayerDataStorage saveHandler, int maxPlayers) { this.cserver = server.server = new CraftServer((DedicatedServer) server, this); -@@ -399,6 +400,13 @@ public abstract class PlayerList { +@@ -397,6 +398,13 @@ public abstract class PlayerList { player.initInventoryMenu(); // CraftBukkit - Moved from above, added world @@ -68,7 +68,7 @@ index 50ceb120d04c3149dd1cca7908a9ea862b25e5ab..e1d9f11a9d5333811fc8cb5dd95c0ca7 PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ()); } -@@ -522,6 +530,16 @@ public abstract class PlayerList { +@@ -519,6 +527,16 @@ public abstract class PlayerList { entityplayer.doTick(); // SPIGOT-924 // CraftBukkit end @@ -85,7 +85,7 @@ index 50ceb120d04c3149dd1cca7908a9ea862b25e5ab..e1d9f11a9d5333811fc8cb5dd95c0ca7 this.save(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -1162,6 +1180,13 @@ public abstract class PlayerList { +@@ -1160,6 +1178,13 @@ public abstract class PlayerList { } // CraftBukkit end diff --git a/patches/server/0096-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/server/0096-Add-handshake-event-to-allow-plugins-to-handle-clien.patch new file mode 100644 index 0000000000..87920d8d8c --- /dev/null +++ b/patches/server/0096-Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: kashike +Date: Wed, 13 Apr 2016 20:21:38 -0700 +Subject: [PATCH] Add handshake event to allow plugins to handle client + handshaking logic themselves + + +diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +index 3634740acd1ca7c13956c56508db5892fd00edc9..9214fb6b8e21ff6aee8be0691f1fe6e41c901ba3 100644 +--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +@@ -120,9 +120,43 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + this.connection.disconnect(ichatmutablecomponent); + } else { + this.connection.setupInboundProtocol(LoginProtocols.SERVERBOUND, new ServerLoginPacketListenerImpl(this.server, this.connection, transfer)); ++ // Paper start - PlayerHandshakeEvent ++ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee; ++ boolean handledByEvent = false; ++ // Try and handle the handshake through the event ++ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me? ++ java.net.SocketAddress socketAddress = this.connection.address; ++ String hostnameOfRemote = socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getHostString() : InetAddress.getLoopbackAddress().getHostAddress(); ++ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packet.hostName(), hostnameOfRemote, !proxyLogicEnabled); ++ if (event.callEvent()) { ++ // If we've failed somehow, let the client know so and go no further. ++ if (event.isFailed()) { ++ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage()); ++ this.connection.send(new ClientboundLoginDisconnectPacket(component)); ++ this.connection.disconnect(component); ++ return; ++ } ++ ++ if (event.getServerHostname() != null) { ++ // change hostname ++ packet = new ClientIntentionPacket( ++ packet.protocolVersion(), ++ event.getServerHostname(), ++ packet.port(), ++ packet.intention() ++ ); ++ } ++ if (event.getSocketAddressHostname() != null) this.connection.address = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); ++ this.connection.spoofedUUID = event.getUniqueId(); ++ this.connection.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); ++ handledByEvent = true; // Hooray, we did it! ++ } ++ } ++ // Paper end + // Spigot Start + String[] split = packet.hostName().split("\00"); +- if (org.spigotmc.SpigotConfig.bungee) { ++ if (!handledByEvent && proxyLogicEnabled) { // Paper ++ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! + if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { + this.connection.hostname = split[0]; + this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); diff --git a/patches/unapplied/server/0098-Configurable-RCON-IP-address.patch b/patches/server/0097-Configurable-RCON-IP-address.patch similarity index 90% rename from patches/unapplied/server/0098-Configurable-RCON-IP-address.patch rename to patches/server/0097-Configurable-RCON-IP-address.patch index 3520bc08a0..5f1a673a18 100644 --- a/patches/unapplied/server/0098-Configurable-RCON-IP-address.patch +++ b/patches/server/0097-Configurable-RCON-IP-address.patch @@ -9,19 +9,19 @@ For servers with multiple IP's, ability to bind to a specific interface. public net.minecraft.server.dedicated.Settings getStringRaw(Ljava/lang/String;)Ljava/lang/String; diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index d64ac84d4c5ef3dd3054a601deee128d3069686b..90fe26a546eeebf90ccf7f899103346cdb3ae702 100644 +index 946b9b9283ca345d711d40cc2cd04039fec5c77b..502e5386ec4306de93148266f60810ec52ae5ab2 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -108,6 +108,8 @@ public class DedicatedServerProperties extends Settings= this.saturatedRegenRate) { // CraftBukkit float f = Math.min(this.saturationLevel, 6.0F); diff --git a/patches/unapplied/server/0100-Add-ability-to-configure-frosted_ice-properties.patch b/patches/server/0099-Add-ability-to-configure-frosted_ice-properties.patch similarity index 90% rename from patches/unapplied/server/0100-Add-ability-to-configure-frosted_ice-properties.patch rename to patches/server/0099-Add-ability-to-configure-frosted_ice-properties.patch index ba6d745387..edd8aee842 100644 --- a/patches/unapplied/server/0100-Add-ability-to-configure-frosted_ice-properties.patch +++ b/patches/server/0099-Add-ability-to-configure-frosted_ice-properties.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Add ability to configure frosted_ice properties diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java -index cabe67a97f3f9058d5671cb5a1a94ff4e9ef199b..1b61e5139d3183de8f9a375e8ef24d302861727d 100644 +index 4d711c0c381ffdda00cbd97fc446a68e25a04c44..83904d2d5e0bd27257a775edab8c55b4a0bb804a 100644 --- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java @@ -40,6 +40,7 @@ public class FrostedIceBlock extends IceBlock { @Override - public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (!world.paperConfig().environment.frostedIce.enabled) return; // Paper - Frosted ice options if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) diff --git a/patches/unapplied/server/0101-remove-null-possibility-for-getServer-singleton.patch b/patches/server/0100-remove-null-possibility-for-getServer-singleton.patch similarity index 86% rename from patches/unapplied/server/0101-remove-null-possibility-for-getServer-singleton.patch rename to patches/server/0100-remove-null-possibility-for-getServer-singleton.patch index 44c5636e56..883422b8df 100644 --- a/patches/unapplied/server/0101-remove-null-possibility-for-getServer-singleton.patch +++ b/patches/server/0100-remove-null-possibility-for-getServer-singleton.patch @@ -6,10 +6,10 @@ Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e6f1a98d4239318944e1ed6128cf8493c795602b..7c403b67179fafe2aeb0f622a63c010bfa742781 100644 +index f46c8dd1ab752a88a3292f82720b27b250625982..ae4a8cb0fb3e36710fedd9a71d0e0efdf0895015 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -190,6 +190,7 @@ import co.aikar.timings.MinecraftTimings; // Paper +@@ -194,6 +194,7 @@ import co.aikar.timings.MinecraftTimings; // Paper public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, CommandSource, AutoCloseable { @@ -17,7 +17,7 @@ index e6f1a98d4239318944e1ed6128cf8493c795602b..7c403b67179fafe2aeb0f622a63c010b public static final Logger LOGGER = LogUtils.getLogger(); public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper public static final String VANILLA_BRAND = "vanilla"; -@@ -321,6 +322,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -@@ -2425,9 +2427,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop lootTable; public long lootTableSeed; + // Paper start @@ -540,42 +540,42 @@ index c163a1219e614ab12b17ae9ba9c7cc4721cecc84..756d0434472921992c9d84597d7c9c82 // CraftBukkit start public List transaction = new java.util.ArrayList(); private int maxStack = MAX_STACK; -@@ -142,12 +156,14 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme +@@ -144,12 +158,14 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @Override protected void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); + this.lootableData.saveNbt(nbt); // Paper - this.addChestVehicleSaveData(nbt); + this.addChestVehicleSaveData(nbt, this.registryAccess()); } @Override protected void readAdditionalSaveData(CompoundTag nbt) { super.readAdditionalSaveData(nbt); + this.lootableData.loadNbt(nbt); // Paper - this.readChestVehicleSaveData(nbt); + this.readChestVehicleSaveData(nbt, this.registryAccess()); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java -index 0e68f692bb9b397cffd7352e7340465b5e3719f4..58af87b8faf4f8d6bdb111c49a429466acface68 100644 +index 025e57993b85402c48db29d65ea3ceaf277ff27a..b04f7ce0805453f6c737fa9dc11c4129ca64e934 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java -@@ -68,12 +68,14 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain +@@ -70,12 +70,14 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain @Override protected void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); + this.lootableData.saveNbt(nbt); // Paper - this.addChestVehicleSaveData(nbt); + this.addChestVehicleSaveData(nbt, this.registryAccess()); } @Override protected void readAdditionalSaveData(CompoundTag nbt) { super.readAdditionalSaveData(nbt); + this.lootableData.loadNbt(nbt); // Paper - this.readChestVehicleSaveData(nbt); + this.readChestVehicleSaveData(nbt, this.registryAccess()); } -@@ -255,6 +257,20 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain - this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of((Entity) player)); +@@ -257,6 +259,20 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain + this.level().gameEvent((Holder) GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.Context.of((Entity) player)); } + // Paper start @@ -596,38 +596,38 @@ index 0e68f692bb9b397cffd7352e7340465b5e3719f4..58af87b8faf4f8d6bdb111c49a429466 public List transaction = new java.util.ArrayList(); private int maxStack = MAX_STACK; diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -index 23551b97bdd865c30d7402cff0e221cfe4b1d9d4..f4ad1eea5bced6997edbc3a5ed1360b12b70f68f 100644 +index dbde2402fd46b0d06e8efeb90be6fb98d7ae7798..f33e5cf6d456e615050047e924d9b24268a2c51e 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -59,9 +59,8 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -65,9 +65,8 @@ public interface ContainerEntity extends Container, MenuProvider { if (this.getLootTableSeed() != 0L) { nbt.putLong("LootTableSeed", this.getLootTableSeed()); } - } else { -- ContainerHelper.saveAllItems(nbt, this.getItemStacks()); +- ContainerHelper.saveAllItems(nbt, this.getItemStacks(), registriesLookup); } -+ ContainerHelper.saveAllItems(nbt, this.getItemStacks()); // Paper - always save the items, table may still remain ++ ContainerHelper.saveAllItems(nbt, this.getItemStacks(), registriesLookup); // Paper - always save the items, table may still remain } - default void readChestVehicleSaveData(CompoundTag nbt) { -@@ -69,9 +68,8 @@ public interface ContainerEntity extends Container, MenuProvider { + default void readChestVehicleSaveData(CompoundTag nbt, HolderLookup.Provider registriesLookup) { +@@ -75,9 +74,8 @@ public interface ContainerEntity extends Container, MenuProvider { if (nbt.contains("LootTable", 8)) { - this.setLootTable(new ResourceLocation(nbt.getString("LootTable"))); + this.setLootTable(ResourceKey.create(Registries.LOOT_TABLE, new ResourceLocation(nbt.getString("LootTable")))); this.setLootTableSeed(nbt.getLong("LootTableSeed")); - } else { -- ContainerHelper.loadAllItems(nbt, this.getItemStacks()); +- ContainerHelper.loadAllItems(nbt, this.getItemStacks(), registriesLookup); } -+ ContainerHelper.loadAllItems(nbt, this.getItemStacks()); // Paper - always load the items, table may still remain ++ ContainerHelper.loadAllItems(nbt, this.getItemStacks(), registriesLookup); // Paper - always save the items, table may still remain } default void chestVehicleDestroyed(DamageSource source, Level world, Entity vehicle) { -@@ -93,13 +91,13 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -99,13 +97,13 @@ public interface ContainerEntity extends Container, MenuProvider { default void unpackChestVehicleLootTable(@Nullable Player player) { MinecraftServer minecraftServer = this.level().getServer(); - if (this.getLootTable() != null && minecraftServer != null) { + if (this.getLootableData().shouldReplenish(player) && minecraftServer != null) { // Paper - LootTable lootTable = minecraftServer.getLootData().getLootTable(this.getLootTable()); + LootTable lootTable = minecraftServer.reloadableRegistries().getLootTable(this.getLootTable()); if (player != null) { CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.getLootTable()); } @@ -637,9 +637,9 @@ index 23551b97bdd865c30d7402cff0e221cfe4b1d9d4..f4ad1eea5bced6997edbc3a5ed1360b1 LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); if (player != null) { builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); -@@ -171,4 +169,13 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -175,4 +173,13 @@ public interface ContainerEntity extends Container, MenuProvider { default boolean isChestVehicleStillValid(Player player) { - return !this.isRemoved() && this.position().closerThan(player.position(), 8.0); + return !this.isRemoved() && player.canInteractWithEntity(this.getBoundingBox(), 4.0); } + // Paper start + default Entity getEntity() { @@ -652,18 +652,18 @@ index 23551b97bdd865c30d7402cff0e221cfe4b1d9d4..f4ad1eea5bced6997edbc3a5ed1360b1 + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -index 1c3763d892e4e2df23ccf7a9fdb126e59b36ab65..f33c4633094002a3dd0c54353b62f7b358628be3 100644 +index c2493c15d8fe4587d6ee2db100cc13303b66b39b..218b2b50aa6ebdf1768da21ad61be888f620565e 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -@@ -17,6 +17,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc +@@ -19,6 +19,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc @Nullable - public ResourceLocation lootTable; - public long lootTableSeed; + public ResourceKey lootTable; + public long lootTableSeed = 0L; + public final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperTileEntityLootableInventory(this)); // Paper protected RandomizableContainerBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); -@@ -43,6 +44,52 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc +@@ -45,6 +46,52 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc this.lootTableSeed = lootTableSeed; } @@ -717,23 +717,23 @@ index 1c3763d892e4e2df23ccf7a9fdb126e59b36ab65..f33c4633094002a3dd0c54353b62f7b3 public boolean isEmpty() { this.unpackLootTable(null); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java -index 86076a9d2a3b1044c96518cbaeee66d60a8a22c6..c268513bc5719d80e1c3d73de53b85ec7f852fa9 100644 +index 949e074a32b6593bd8b7405499e686a074e283e5..398ffe274bddee2b01350b9490def3d2fe854917 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java -@@ -64,7 +64,7 @@ public class CraftBrushableBlock extends CraftBlockEntityState explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions @@ -18,7 +18,7 @@ index 424377f062c6443460a9814feb8b90e7bef71c6a..0137f61a572800ea7bb013185835a1ad public CraftWorld getWorld() { return this.world; diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java -index 68da47c3ec59518a4bbeb03c196ef0e7c6b5d049..1dbfda52a4423fb031eecad24e5766f49ecf6050 100644 +index 20d20db2639030c103e9d1b3c8da0f51344b81c2..ceba9617748a8b4f3a9bd459475952c9c6c9ed7c 100644 --- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java @@ -24,7 +24,7 @@ public class RedstoneTorchBlock extends BaseTorchBlock { @@ -32,9 +32,9 @@ index 68da47c3ec59518a4bbeb03c196ef0e7c6b5d049..1dbfda52a4423fb031eecad24e5766f4 public static final int RESTART_DELAY = 160; @@ -80,11 +80,15 @@ public class RedstoneTorchBlock extends BaseTorchBlock { @Override - public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { boolean flag = this.hasNeighborSignal(world, pos, state); -- List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world); +- List list = (List) RedstoneTorchBlock.RECENT_TOGGLES.get(world); - - while (list != null && !list.isEmpty() && world.getGameTime() - ((RedstoneTorchBlock.Toggle) list.get(0)).when > 60L) { - list.remove(0); diff --git a/patches/unapplied/server/0108-Add-server-name-parameter.patch b/patches/server/0107-Add-server-name-parameter.patch similarity index 90% rename from patches/unapplied/server/0108-Add-server-name-parameter.patch rename to patches/server/0107-Add-server-name-parameter.patch index 6dfa8a2767..465d38a30d 100644 --- a/patches/unapplied/server/0108-Add-server-name-parameter.patch +++ b/patches/server/0107-Add-server-name-parameter.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add server-name parameter diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index bdff750f44cabdbc7e329a0feaa77709e2103635..db36453ff46afded45268b3701488e23305aa2eb 100644 +index 3c4a593cfbc111084abc971bc7532898d094bd9a..dc93fd6f89694d9ae3c05de9a9d427ecce564fc9 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -167,6 +167,14 @@ public class Main { diff --git a/patches/unapplied/server/0109-Fix-global-sound-handling.patch b/patches/server/0108-Fix-global-sound-handling.patch similarity index 91% rename from patches/unapplied/server/0109-Fix-global-sound-handling.patch rename to patches/server/0108-Fix-global-sound-handling.patch index 3832607897..5ee797e55c 100644 --- a/patches/unapplied/server/0109-Fix-global-sound-handling.patch +++ b/patches/server/0108-Fix-global-sound-handling.patch @@ -11,10 +11,10 @@ Co-authored-by: lexikiq Co-authored-by: Aikar diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c9c711398cf90fc1990a0145196fa05894f9ffff..76246fdacf70309918ce413f494bdb4d8683241d 100644 +index d23a2cfeddf7ef9d10b0b12e0425df759e1fd080..66b21ba4b3206fb52570eb67faeb1161bd043545 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1318,7 +1318,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1324,7 +1324,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override public void levelEvent(@Nullable Player player, int eventId, BlockPos pos, int data) { @@ -24,10 +24,10 @@ index c9c711398cf90fc1990a0145196fa05894f9ffff..76246fdacf70309918ce413f494bdb4d public int getLogicalHeight() { diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index 99f390e64477e92939bf0552878ed11d0db0137f..0df9780c1689532d0d9f236077400b298d8e9f68 100644 +index 53ff70fff0d12a151d13481a3226f72af57cce3e..993ccde9e6ee769ce51cdfa4ff06cfe1bd27bbb0 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -681,11 +681,12 @@ public class EnderDragon extends Mob implements Enemy { +@@ -679,11 +679,12 @@ public class EnderDragon extends Mob implements Enemy { // CraftBukkit start - Use relative location for far away sounds // this.level().globalLevelEvent(1028, this.blockPosition(), 0); int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16; @@ -43,10 +43,10 @@ index 99f390e64477e92939bf0552878ed11d0db0137f..0df9780c1689532d0d9f236077400b29 double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -index c098ce5ab4b01d352e5e351f81773134128ce90b..e3da459190625a037e5542aa6ba3365f05f9f532 100644 +index ff04f392163c2f7b1015ce379706d19a5f655f5c..b0ac85dc3c67d2e4d70dfb09d4e8fc349aba14d2 100644 --- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java -@@ -272,11 +272,12 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob +@@ -278,11 +278,12 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob // CraftBukkit start - Use relative location for far away sounds // this.level().globalLevelEvent(1023, new BlockPosition(this), 0); int viewDistance = ((ServerLevel) this.level()).getCraftServer().getViewDistance() * 16; @@ -62,10 +62,10 @@ index c098ce5ab4b01d352e5e351f81773134128ce90b..e3da459190625a037e5542aa6ba3365f double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; diff --git a/src/main/java/net/minecraft/world/item/EnderEyeItem.java b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -index 5bc68514a1e8a212e2681f06b918548c0ec565b6..1977e702f6af39ebf100c1f2f2edc2d1c4d003b0 100644 +index 6df874ac5091896be5edddd362c11958c0ad815b..37cfb9694dc06f693b7b54f20bc31dfd9f95c76c 100644 --- a/src/main/java/net/minecraft/world/item/EnderEyeItem.java +++ b/src/main/java/net/minecraft/world/item/EnderEyeItem.java -@@ -64,11 +64,12 @@ public class EnderEyeItem extends Item { +@@ -65,11 +65,12 @@ public class EnderEyeItem extends Item { // world.b(1038, blockposition1.c(1, 0, 1), 0); int viewDistance = world.getCraftServer().getViewDistance() * 16; BlockPos soundPos = blockposition1.offset(1, 0, 1); @@ -81,10 +81,10 @@ index 5bc68514a1e8a212e2681f06b918548c0ec565b6..1977e702f6af39ebf100c1f2f2edc2d1 double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.getX() + (deltaX / deltaLength) * viewDistance; diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 0137f61a572800ea7bb013185835a1ad4cd0462c..1ecde4f1dff5bfa67c526a699061f1952da59fae 100644 +index afb1c203f6299b90179244b4b0d0c6332f961e35..57856f334370da394e9119fb1f8c7fb9c4916aa3 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -1269,4 +1269,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -1263,4 +1263,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { private ExplosionInteraction() {} } diff --git a/patches/unapplied/server/0110-Avoid-blocking-on-Network-Manager-creation.patch b/patches/server/0109-Avoid-blocking-on-Network-Manager-creation.patch similarity index 92% rename from patches/unapplied/server/0110-Avoid-blocking-on-Network-Manager-creation.patch rename to patches/server/0109-Avoid-blocking-on-Network-Manager-creation.patch index 16784d8691..1c6ee84de8 100644 --- a/patches/unapplied/server/0110-Avoid-blocking-on-Network-Manager-creation.patch +++ b/patches/server/0109-Avoid-blocking-on-Network-Manager-creation.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Avoid blocking on Network Manager creation Per Paper issue 294 diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java -index dbbca784fe45b7099f683745b36f5c195ca4c2af..187b2cf175ba5cea94158d29b53993dc5a7c5b94 100644 +index 2cf3e79ec5e8706b71d27ebad4668773f0b91195..64119f2188f8958b8a5913fec82ac5bba1b74b2a 100644 --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -61,6 +61,15 @@ public class ServerConnectionListener { @@ -25,7 +25,7 @@ index dbbca784fe45b7099f683745b36f5c195ca4c2af..187b2cf175ba5cea94158d29b53993dc public ServerConnectionListener(MinecraftServer server) { this.server = server; -@@ -100,7 +109,8 @@ public class ServerConnectionListener { +@@ -102,7 +111,8 @@ public class ServerConnectionListener { int j = ServerConnectionListener.this.server.getRateLimitPacketsPerSecond(); Connection object = j > 0 ? new RateKickingConnection(j) : new Connection(PacketFlow.SERVERBOUND); // CraftBukkit - decompile error @@ -35,7 +35,7 @@ index dbbca784fe45b7099f683745b36f5c195ca4c2af..187b2cf175ba5cea94158d29b53993dc ((Connection) object).configurePacketHandler(channelpipeline); ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); } -@@ -163,6 +173,7 @@ public class ServerConnectionListener { +@@ -164,6 +174,7 @@ public class ServerConnectionListener { synchronized (this.connections) { // Spigot Start diff --git a/patches/unapplied/server/0111-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch b/patches/server/0110-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch similarity index 90% rename from patches/unapplied/server/0111-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch rename to patches/server/0110-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch index c4975570f8..82dc93463f 100644 --- a/patches/unapplied/server/0111-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch +++ b/patches/server/0110-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't lookup game profiles that have no UUID and no name diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 370cf30a6411577ec8ed7a32e473217e2f64782b..3c9c6a697143c7e980add58576ad288b8f51ae35 100644 +index 5b219b5eee0c5958b80093c9223feeed0dec830b..bc7143ad915f001726e8558c8ca4160f3f9ace68 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -89,6 +89,7 @@ public class GameProfileCache { diff --git a/patches/unapplied/server/0112-Add-setting-for-proxy-online-mode-status.patch b/patches/server/0111-Add-setting-for-proxy-online-mode-status.patch similarity index 89% rename from patches/unapplied/server/0112-Add-setting-for-proxy-online-mode-status.patch rename to patches/server/0111-Add-setting-for-proxy-online-mode-status.patch index 424349ba65..f660a5693e 100644 --- a/patches/unapplied/server/0112-Add-setting-for-proxy-online-mode-status.patch +++ b/patches/server/0111-Add-setting-for-proxy-online-mode-status.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add setting for proxy online mode status TODO: Add isProxyOnlineMode check to Metrics diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 590da3a7acef406589e665652ccc46e01cc28e1b..c8163a8645248765c0fa6c15bc8c37facdc70dc7 100644 +index 2caebd76cd533cf6874b6461b496e76e8ec85d61..0ffa25a6e41cc56e78c79e0cee45e3b811794129 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -557,7 +557,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -589,7 +589,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface public boolean enforceSecureProfile() { DedicatedServerProperties dedicatedserverproperties = this.getProperties(); @@ -23,7 +23,7 @@ index 590da3a7acef406589e665652ccc46e01cc28e1b..c8163a8645248765c0fa6c15bc8c37fa @Override diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 3c9c6a697143c7e980add58576ad288b8f51ae35..92c22dc10e385f1942f2ec375bbce9faf257462b 100644 +index bc7143ad915f001726e8558c8ca4160f3f9ace68..aeb0c7ce9b6f93dadd407dbdefba053568f2e2fe 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -89,7 +89,8 @@ public class GameProfileCache { @@ -46,7 +46,7 @@ index 3c9c6a697143c7e980add58576ad288b8f51ae35..92c22dc10e385f1942f2ec375bbce9fa public void add(GameProfile profile) { diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java -index 9143ce01650b51e7f6a677c5941ade91a506449f..86c88e81e275d52576122a5083b419e64cb011fc 100644 +index a0b0614ac7d2009db5c6c10ab4a5f09dd447c635..653856d0b8dcf2baf4cc77a276f17c8cc1fa717e 100644 --- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java +++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java @@ -65,7 +65,8 @@ public class OldUsersConverter { @@ -60,10 +60,10 @@ index 9143ce01650b51e7f6a677c5941ade91a506449f..86c88e81e275d52576122a5083b419e6 } else { String[] astring1 = astring; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f69d5e8f22fa8335b19f9e777ddbd33443eb08dc..1bb70e2363b8d046090c8f5853de590fa6777e7d 100644 +index c625ed2039566a1a175a8100fb8a42566f1cfb1a..8624a530d534e45f5ff6f834d595137daa4ae453 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1833,7 +1833,7 @@ public final class CraftServer implements Server { +@@ -1849,7 +1849,7 @@ public final class CraftServer implements Server { if (result == null) { GameProfile profile = null; // Only fetch an online UUID in online mode diff --git a/patches/unapplied/server/0113-Optimise-BlockState-s-hashCode-equals.patch b/patches/server/0112-Optimise-BlockState-s-hashCode-equals.patch similarity index 100% rename from patches/unapplied/server/0113-Optimise-BlockState-s-hashCode-equals.patch rename to patches/server/0112-Optimise-BlockState-s-hashCode-equals.patch diff --git a/patches/unapplied/server/0114-Configurable-packet-in-spam-threshold.patch b/patches/server/0113-Configurable-packet-in-spam-threshold.patch similarity index 91% rename from patches/unapplied/server/0114-Configurable-packet-in-spam-threshold.patch rename to patches/server/0113-Configurable-packet-in-spam-threshold.patch index b14c58ef25..98e99146cc 100644 --- a/patches/unapplied/server/0114-Configurable-packet-in-spam-threshold.patch +++ b/patches/server/0113-Configurable-packet-in-spam-threshold.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable packet in spam threshold diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 19ff229f90d07447947afa8b4794b683feceb574..6a0e6697331732555f9e4e63e95dce0a2bfc1a85 100644 +index 00043179d939e95734d56d221d79c0996321f875..053c1299d657dba38308b9d0fddd7416c357364d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1529,13 +1529,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1528,13 +1528,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Spigot start - limit place/interactions private int limitedPackets; private long lastLimitedPacket = -1; diff --git a/patches/unapplied/server/0115-Configurable-flying-kick-messages.patch b/patches/server/0114-Configurable-flying-kick-messages.patch similarity index 75% rename from patches/unapplied/server/0115-Configurable-flying-kick-messages.patch rename to patches/server/0114-Configurable-flying-kick-messages.patch index 4bc41b33a5..545bf77361 100644 --- a/patches/unapplied/server/0115-Configurable-flying-kick-messages.patch +++ b/patches/server/0114-Configurable-flying-kick-messages.patch @@ -5,21 +5,21 @@ Subject: [PATCH] Configurable flying kick messages diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6a0e6697331732555f9e4e63e95dce0a2bfc1a85..76d3ecbe62775b09aca1306b1adab56a5c730162 100644 +index 053c1299d657dba38308b9d0fddd7416c357364d..19b4e2a2c01a10642ced9bdffc0acb661b270741 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -338,7 +338,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -352,7 +352,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) { - if (++this.aboveGroundTickCount > 80) { + if (++this.aboveGroundTickCount > this.getMaximumFlyingTicks(this.player)) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); - this.disconnect(Component.translatable("multiplayer.disconnect.flying")); + this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingPlayer); // Paper - use configurable kick message return; } } else { -@@ -357,7 +357,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) { - if (++this.aboveGroundVehicleTickCount > 80) { +@@ -371,7 +371,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + if (this.clientVehicleIsFloating && this.lastVehicle.getControllingPassenger() == this.player) { + if (++this.aboveGroundVehicleTickCount > this.getMaximumFlyingTicks(this.lastVehicle)) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); - this.disconnect(Component.translatable("multiplayer.disconnect.flying")); + this.disconnect(io.papermc.paper.configuration.GlobalConfiguration.get().messages.kick.flyingVehicle); // Paper - use configurable kick message diff --git a/patches/unapplied/server/0116-Add-EntityZapEvent.patch b/patches/server/0115-Add-EntityZapEvent.patch similarity index 88% rename from patches/unapplied/server/0116-Add-EntityZapEvent.patch rename to patches/server/0115-Add-EntityZapEvent.patch index fa810b79bd..a54599fb44 100644 --- a/patches/unapplied/server/0116-Add-EntityZapEvent.patch +++ b/patches/server/0115-Add-EntityZapEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityZapEvent diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index e1311841cdf79fa2769cfa6817985007ace2e4d8..e7db715d45d27cbc9b3ed7cad1d907273b225c7f 100644 +index 7d1386f2f4d4b5dcf63b6b4e678568b6744a99b5..0da329781f0afd4ec4a731889b892afe7e399d21 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -852,10 +852,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -844,10 +844,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @Override public void thunderHit(ServerLevel world, LightningBolt lightning) { if (world.getDifficulty() != Difficulty.PEACEFUL) { @@ -25,13 +25,13 @@ index e1311841cdf79fa2769cfa6817985007ace2e4d8..e7db715d45d27cbc9b3ed7cad1d90727 + // Paper end - Add EntityZapEvent + entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null); + entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null); entitywitch.setNoAi(this.isNoAi()); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 8de2f4ca83017d37c63d33c6283078a71143f077..5e566d08346084880d88b406c6ce80328e26a180 100644 +index ff95b1f9935311ec156e41bf9aa16005df23eb27..168f19c754e413286c69ae9cbcbfb3788f05d8ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1198,6 +1198,14 @@ public class CraftEventFactory { +@@ -1193,6 +1193,14 @@ public class CraftEventFactory { return !event.isCancelled(); } diff --git a/patches/unapplied/server/0117-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch b/patches/server/0116-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch similarity index 86% rename from patches/unapplied/server/0117-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch rename to patches/server/0116-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch index 9d998d7123..c961e57817 100644 --- a/patches/unapplied/server/0117-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch +++ b/patches/server/0116-Filter-bad-block-entity-nbt-data-from-falling-blocks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Filter bad block entity nbt data from falling blocks diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index 9136b0c907d331e100d47e1a800ae2e2c2ec6dad..c0477f913867c67809978a4f240303151d81e6ea 100644 +index 37dfd08621d402a339f36bb70f1b39de010e8669..cc00bf81de902cfc587bcf6f18e861fd4339c91e 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -333,7 +333,7 @@ public class FallingBlockEntity extends Entity { +@@ -335,7 +335,7 @@ public class FallingBlockEntity extends Entity { this.dropItem = nbt.getBoolean("DropItem"); } diff --git a/patches/unapplied/server/0118-Cache-user-authenticator-threads.patch b/patches/server/0117-Cache-user-authenticator-threads.patch similarity index 85% rename from patches/unapplied/server/0118-Cache-user-authenticator-threads.patch rename to patches/server/0117-Cache-user-authenticator-threads.patch index ca76a3254f..04a32d1e53 100644 --- a/patches/unapplied/server/0118-Cache-user-authenticator-threads.patch +++ b/patches/server/0117-Cache-user-authenticator-threads.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Cache user authenticator threads diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 55c15d942ddd230dec073039b7c5f95a14ff937c..c5b451a706240dbd6719e001825c6859fc1b2a49 100644 +index eb69b213a75df72dd7b37f41d86564f7fc692e32..b03d4f12e89b8a5fe6ad2282f8cc2909b87795a9 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -49,6 +49,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - +@@ -69,6 +69,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + // CraftBukkit end private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0); static final Logger LOGGER = LogUtils.getLogger(); + private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads private static final int MAX_TICKS_BEFORE_LOGIN = 600; - private static final Component DISCONNECT_UNEXPECTED_QUERY = Component.translatable("multiplayer.disconnect.unexpected_query_response"); private final byte[] challenge; -@@ -140,7 +141,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge)); + final MinecraftServer server; +@@ -167,7 +168,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, + this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true)); } else { // CraftBukkit start - Thread thread = new Thread("User Authenticator #" + ServerLoginPacketListenerImpl.UNIQUE_THREAD_ID.incrementAndGet()) { @@ -26,7 +26,7 @@ index 55c15d942ddd230dec073039b7c5f95a14ff937c..c5b451a706240dbd6719e001825c6859 @Override public void run() { -@@ -155,10 +157,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -182,10 +184,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, ServerLoginPacketListenerImpl.this.server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex); } } @@ -39,7 +39,7 @@ index 55c15d942ddd230dec073039b7c5f95a14ff937c..c5b451a706240dbd6719e001825c6859 // CraftBukkit end } -@@ -225,7 +225,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -264,7 +264,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, throw new IllegalStateException("Protocol error", cryptographyexception); } @@ -49,7 +49,7 @@ index 55c15d942ddd230dec073039b7c5f95a14ff937c..c5b451a706240dbd6719e001825c6859 public void run() { String s1 = (String) Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); -@@ -273,10 +274,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -312,10 +313,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, return ServerLoginPacketListenerImpl.this.server.getPreventProxyConnections() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; } diff --git a/patches/unapplied/server/0119-Allow-Reloading-of-Command-Aliases.patch b/patches/server/0118-Allow-Reloading-of-Command-Aliases.patch similarity index 90% rename from patches/unapplied/server/0119-Allow-Reloading-of-Command-Aliases.patch rename to patches/server/0118-Allow-Reloading-of-Command-Aliases.patch index 139cd4051d..84b11ff12b 100644 --- a/patches/unapplied/server/0119-Allow-Reloading-of-Command-Aliases.patch +++ b/patches/server/0118-Allow-Reloading-of-Command-Aliases.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases Reload the aliases stored in commands.yml diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1bb70e2363b8d046090c8f5853de590fa6777e7d..9978f3ffb3803b7f9278d49a688bc2d4bf740cf3 100644 +index 8624a530d534e45f5ff6f834d595137daa4ae453..c49dfa14a95b495a615fcf2d400a1630f7a698dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2754,5 +2754,24 @@ public final class CraftServer implements Server { +@@ -2777,5 +2777,24 @@ public final class CraftServer implements Server { DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); } diff --git a/patches/unapplied/server/0120-Add-source-to-PlayerExpChangeEvent.patch b/patches/server/0119-Add-source-to-PlayerExpChangeEvent.patch similarity index 87% rename from patches/unapplied/server/0120-Add-source-to-PlayerExpChangeEvent.patch rename to patches/server/0119-Add-source-to-PlayerExpChangeEvent.patch index 1899d75ec1..1a4c72d2eb 100644 --- a/patches/unapplied/server/0120-Add-source-to-PlayerExpChangeEvent.patch +++ b/patches/server/0119-Add-source-to-PlayerExpChangeEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add source to PlayerExpChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index dfa16aa79e94d85a49c9c28229b29a972ec6e216..7ce46bd254e0f14b1bbafe37e0eb97a468a07083 100644 +index 4d1001666204b2a2c2bf26231bb1b19f9a1bd8ed..1f29ed95ef3d1904a014715028d9d591fe39231f 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -255,7 +255,7 @@ public class ExperienceOrb extends Entity { +@@ -261,7 +261,7 @@ public class ExperienceOrb extends Entity { int i = this.repairPlayerItems(player, this.value); if (i > 0) { @@ -18,10 +18,10 @@ index dfa16aa79e94d85a49c9c28229b29a972ec6e216..7ce46bd254e0f14b1bbafe37e0eb97a4 --this.count; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 5e566d08346084880d88b406c6ce80328e26a180..81927bb6579b9a2119e377026d4e778daddb7f12 100644 +index 168f19c754e413286c69ae9cbcbfb3788f05d8ff..3683cf6765741f6422f478fd09ce1ba6a75d6b99 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1151,6 +1151,17 @@ public class CraftEventFactory { +@@ -1146,6 +1146,17 @@ public class CraftEventFactory { return event; } diff --git a/patches/unapplied/server/0121-Add-ProjectileCollideEvent.patch b/patches/server/0120-Add-ProjectileCollideEvent.patch similarity index 91% rename from patches/unapplied/server/0121-Add-ProjectileCollideEvent.patch rename to patches/server/0120-Add-ProjectileCollideEvent.patch index ea1d52d913..72842141bf 100644 --- a/patches/unapplied/server/0121-Add-ProjectileCollideEvent.patch +++ b/patches/server/0120-Add-ProjectileCollideEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add ProjectileCollideEvent Deprecated now and replaced with ProjectileHitEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 81927bb6579b9a2119e377026d4e778daddb7f12..2bcac771a37b3e5d3b7173e24dad7823fb29757c 100644 +index 3683cf6765741f6422f478fd09ce1ba6a75d6b99..f7c848aa883c1ad408e7e16e605f375ab75f8cfd 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1295,6 +1295,17 @@ public class CraftEventFactory { +@@ -1290,6 +1290,17 @@ public class CraftEventFactory { return CraftItemStack.asNMSCopy(bitem); } @@ -27,7 +27,7 @@ index 81927bb6579b9a2119e377026d4e778daddb7f12..2bcac771a37b3e5d3b7173e24dad7823 public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) { Projectile bukkitEntity = (Projectile) entity.getBukkitEntity(); ProjectileLaunchEvent event = new ProjectileLaunchEvent(bukkitEntity); -@@ -1319,8 +1330,15 @@ public class CraftEventFactory { +@@ -1314,8 +1325,15 @@ public class CraftEventFactory { if (position.getType() == HitResult.Type.ENTITY) { hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity(); } diff --git a/patches/unapplied/server/0122-Prevent-Pathfinding-out-of-World-Border.patch b/patches/server/0121-Prevent-Pathfinding-out-of-World-Border.patch similarity index 94% rename from patches/unapplied/server/0122-Prevent-Pathfinding-out-of-World-Border.patch rename to patches/server/0121-Prevent-Pathfinding-out-of-World-Border.patch index 6c97c14e17..ce3053228d 100644 --- a/patches/unapplied/server/0122-Prevent-Pathfinding-out-of-World-Border.patch +++ b/patches/server/0121-Prevent-Pathfinding-out-of-World-Border.patch @@ -13,7 +13,7 @@ by adding code to all overrides in: to return BLOCKED if it is outside the world border. diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index fa5088945adc5e41e34cc2dc21a1762d106254c8..25a9f1fd69fbafab5129740e26e9741e35885ce0 100644 +index 21bbc98b26b270b3ad6a3b34d6e50dfb796c3d5a..188904c9f0f81db1d63eec953d6746f2dc23dc81 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java @@ -158,7 +158,7 @@ public abstract class PathNavigation { diff --git a/patches/unapplied/server/0123-Optimize-Level.hasChunkAt-BlockPosition-Z.patch b/patches/server/0122-Optimize-Level.hasChunkAt-BlockPosition-Z.patch similarity index 87% rename from patches/unapplied/server/0123-Optimize-Level.hasChunkAt-BlockPosition-Z.patch rename to patches/server/0122-Optimize-Level.hasChunkAt-BlockPosition-Z.patch index 5a64d1f8f3..b20375f51a 100644 --- a/patches/unapplied/server/0123-Optimize-Level.hasChunkAt-BlockPosition-Z.patch +++ b/patches/server/0122-Optimize-Level.hasChunkAt-BlockPosition-Z.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize Level.hasChunkAt(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1ecde4f1dff5bfa67c526a699061f1952da59fae..926e4f9760e07ab66405132de2e96306211e5b9c 100644 +index 57856f334370da394e9119fb1f8c7fb9c4916aa3..b2b0dea688df220a06abd458ac47aae3d67a7797 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -348,6 +348,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -342,6 +342,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { return chunk == null ? null : chunk.getFluidState(blockposition); } diff --git a/patches/unapplied/server/0124-Bound-Treasure-Maps-to-World-Border.patch b/patches/server/0123-Bound-Treasure-Maps-to-World-Border.patch similarity index 91% rename from patches/unapplied/server/0124-Bound-Treasure-Maps-to-World-Border.patch rename to patches/server/0123-Bound-Treasure-Maps-to-World-Border.patch index b48b9a0a34..507479d986 100644 --- a/patches/unapplied/server/0124-Bound-Treasure-Maps-to-World-Border.patch +++ b/patches/server/0123-Bound-Treasure-Maps-to-World-Border.patch @@ -11,7 +11,7 @@ that is outside happens to be closer, but unreachable, yet another reachable one is in border that would of been missed. diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java -index 52325a99ea38530ad69a39ac0215233139f35268..bf5ac907507bf3b5bfcef45b566c0bc12626e2c0 100644 +index c34873ec974eeffbc4f66dab4584c696cbe10967..580eb275942570da9e68287ca75da886ba1248c0 100644 --- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java +++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java @@ -37,6 +37,18 @@ public class WorldBorder { @@ -34,10 +34,10 @@ index 52325a99ea38530ad69a39ac0215233139f35268..bf5ac907507bf3b5bfcef45b566c0bc1 return (double) pos.getMaxBlockX() > this.getMinX() && (double) pos.getMinBlockX() < this.getMaxX() && (double) pos.getMaxBlockZ() > this.getMinZ() && (double) pos.getMinBlockZ() < this.getMaxZ(); } diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index b2f9429e0d437cf70bf56410e163e957b80ebdf1..4a731b9170222a5a2b0089ef5e9527dbd46a9ad5 100644 +index 28bc3447ff5ddc066a9a743d5bfa7ca69598cd51..7cdb59cd2f2ffe1195d21519ef97dae0e430285b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -217,6 +217,7 @@ public abstract class ChunkGenerator { +@@ -223,6 +223,7 @@ public abstract class ChunkGenerator { while (iterator.hasNext()) { ChunkPos chunkcoordintpair = (ChunkPos) iterator.next(); diff --git a/patches/unapplied/server/0125-Configurable-Cartographer-Treasure-Maps.patch b/patches/server/0124-Configurable-Cartographer-Treasure-Maps.patch similarity index 91% rename from patches/unapplied/server/0125-Configurable-Cartographer-Treasure-Maps.patch rename to patches/server/0124-Configurable-Cartographer-Treasure-Maps.patch index 7253601c50..52b259bda3 100644 --- a/patches/unapplied/server/0125-Configurable-Cartographer-Treasure-Maps.patch +++ b/patches/server/0124-Configurable-Cartographer-Treasure-Maps.patch @@ -9,10 +9,10 @@ Also allow turning off treasure maps all together as they can eat up Map ID's which are limited in quantity. diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -index 22dd4d2a53cc99bcc863f7ef75e2e7b711ceb2b6..9b9afc01c287528b911e13cabd95f41c0d822a48 100644 +index 672301d47037f96f32c52fa400ed28694f3b138b..96240f8ed0675ebfd403fcef144657885c4bb9a9 100644 --- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -@@ -1641,7 +1641,8 @@ public class VillagerTrades { +@@ -1667,7 +1667,8 @@ public class VillagerTrades { return null; } else { ServerLevel serverLevel = (ServerLevel)entity.level(); @@ -23,10 +23,10 @@ index 22dd4d2a53cc99bcc863f7ef75e2e7b711ceb2b6..9b9afc01c287528b911e13cabd95f41c ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true); MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -index 59fa50fb8614d1492e31362feccc100701b56b8e..0bf1291fa4abf7f17381a48651a846379cedb3e1 100644 +index e7f2cc799e7c50a9525845347a3f235f7bfefe41..709bc6838d20c420c5a4b3a994a041e594bd6210 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -@@ -83,8 +83,17 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { +@@ -84,8 +84,17 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); if (vec3 != null) { ServerLevel serverLevel = context.getLevel(); diff --git a/patches/unapplied/server/0126-Add-API-methods-to-control-if-armor-stands-can-move.patch b/patches/server/0125-Add-API-methods-to-control-if-armor-stands-can-move.patch similarity index 90% rename from patches/unapplied/server/0126-Add-API-methods-to-control-if-armor-stands-can-move.patch rename to patches/server/0125-Add-API-methods-to-control-if-armor-stands-can-move.patch index d1601d12d7..0921060796 100644 --- a/patches/unapplied/server/0126-Add-API-methods-to-control-if-armor-stands-can-move.patch +++ b/patches/server/0125-Add-API-methods-to-control-if-armor-stands-can-move.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add API methods to control if armor stands can move diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -index 7e105760198c3b6ce782c14d71cd915e3b071684..1353bb583ec576345b7bfea5134c4b0d59811a07 100644 +index 4caa354922110c8662549bae271f1f7cf1a2168f..d33c49c4a4b87a5203f9b4592deff9389e6e870d 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -93,6 +93,7 @@ public class ArmorStand extends LivingEntity { +@@ -96,6 +96,7 @@ public class ArmorStand extends LivingEntity { public Rotations rightArmPose; public Rotations leftLegPose; public Rotations rightLegPose; @@ -16,7 +16,7 @@ index 7e105760198c3b6ce782c14d71cd915e3b071684..1353bb583ec576345b7bfea5134c4b0d public ArmorStand(EntityType type, Level world) { super(type, world); -@@ -938,4 +939,13 @@ public class ArmorStand extends LivingEntity { +@@ -936,4 +937,13 @@ public class ArmorStand extends LivingEntity { public boolean canBeSeenByAnyone() { return !this.isInvisible() && !this.isMarker(); } diff --git a/patches/server/0126-String-based-Action-Bar-API.patch b/patches/server/0126-String-based-Action-Bar-API.patch new file mode 100644 index 0000000000..84f235f504 --- /dev/null +++ b/patches/server/0126-String-based-Action-Bar-API.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Tue, 27 Dec 2016 15:02:42 -0500 +Subject: [PATCH] String based Action Bar API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 37bf685ee6a01a32d369f0154e7b2446c58efd4c..880fb42eb3bf43638b5a6a544aacd8b6a93d4cd9 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -385,6 +385,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + + // Paper start ++ @Override ++ @Deprecated ++ public void sendActionBar(BaseComponent[] message) { ++ if (getHandle().connection == null) return; ++ net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket packet = new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(org.bukkit.craftbukkit.util.CraftChatMessage.fromJSON(net.md_5.bungee.chat.ComponentSerializer.toString(message))); ++ getHandle().connection.send(packet); ++ } ++ ++ @Override ++ @Deprecated ++ public void sendActionBar(String message) { ++ if (getHandle().connection == null || message == null || message.isEmpty()) return; ++ getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket(CraftChatMessage.fromStringOrNull(message))); ++ } ++ ++ @Override ++ @Deprecated ++ public void sendActionBar(char alternateChar, String message) { ++ if (message == null || message.isEmpty()) return; ++ sendActionBar(org.bukkit.ChatColor.translateAlternateColorCodes(alternateChar, message)); ++ } ++ + @Override + public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) { + if (header != null) { diff --git a/patches/unapplied/server/0128-Properly-fix-item-duplication-bug.patch b/patches/server/0127-Properly-fix-item-duplication-bug.patch similarity index 82% rename from patches/unapplied/server/0128-Properly-fix-item-duplication-bug.patch rename to patches/server/0127-Properly-fix-item-duplication-bug.patch index 0d3f7e5666..20fb4016e1 100644 --- a/patches/unapplied/server/0128-Properly-fix-item-duplication-bug.patch +++ b/patches/server/0127-Properly-fix-item-duplication-bug.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 50264a1da70f120f9adf1619dd72d834ba14e499..54f343a1979794781757b221514f70aa0f7a5dec 100644 +index 532282ba4432f55596337f7a0898ecc3d5dc2148..82498ec7f0de4c1b82c7882824587ed3ba7fd5d6 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2451,7 +2451,7 @@ public class ServerPlayer extends Player { +@@ -2549,7 +2549,7 @@ public class ServerPlayer extends Player { @Override public boolean isImmobile() { @@ -19,10 +19,10 @@ index 50264a1da70f120f9adf1619dd72d834ba14e499..54f343a1979794781757b221514f70aa @Override diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 66497960995dc30abe60d26200979a78513ff2c6..4ff58939269f420fab18fea8fc3887e86297b99e 100644 +index d0178fc884b57cda9090a80716685994ca1a323e..d9a22808381bd8b1be691cf879f5be8cc3add81c 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -146,7 +146,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -167,7 +167,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } public final boolean isDisconnected() { diff --git a/patches/unapplied/server/0129-Firework-API-s.patch b/patches/server/0128-Firework-API-s.patch similarity index 65% rename from patches/unapplied/server/0129-Firework-API-s.patch rename to patches/server/0128-Firework-API-s.patch index c562b87811..97437e72f2 100644 --- a/patches/unapplied/server/0129-Firework-API-s.patch +++ b/patches/server/0128-Firework-API-s.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Firework API's public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 9d637e005205a32fa5406ba47de7cd2b22ead9cf..813c4a52c8ddd70e252125ebfd3654346c71f13c 100644 +index f180488e3613277ed91a5e83963187f33f26b2ea..3df4005b6ddc075e5922c1e96e4ceb21d8b8ea43 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -40,6 +40,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -42,6 +42,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { public int lifetime; @Nullable public LivingEntity attachedToEntity; @@ -18,9 +18,9 @@ index 9d637e005205a32fa5406ba47de7cd2b22ead9cf..813c4a52c8ddd70e252125ebfd365434 public FireworkRocketEntity(EntityType type, Level world) { super(type, world); -@@ -315,6 +316,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { - } - +@@ -299,6 +300,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { + nbt.putInt("LifeTime", this.lifetime); + nbt.put("FireworksItem", this.getItem().save(this.registryAccess())); nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE)); + // Paper start + if (this.spawningEntity != null) { @@ -30,7 +30,7 @@ index 9d637e005205a32fa5406ba47de7cd2b22ead9cf..813c4a52c8ddd70e252125ebfd365434 } @Override -@@ -331,7 +337,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -315,7 +321,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { if (nbt.contains("ShotAtAngle")) { this.entityData.set(FireworkRocketEntity.DATA_SHOT_AT_ANGLE, nbt.getBoolean("ShotAtAngle")); } @@ -42,24 +42,29 @@ index 9d637e005205a32fa5406ba47de7cd2b22ead9cf..813c4a52c8ddd70e252125ebfd365434 + // Paper end } - @Override + private List getExplosions() { diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java -index ac7371882d15746e9353865635d0bb716f890c53..ba570f1c9654e1004e068a1efe2118f36c954505 100644 +index c797fc980577d77e18cd5ea660e4c42ca0f21747..65f23bfb2de91be7560800ff87eab7ad88cb1849 100644 --- a/src/main/java/net/minecraft/world/item/CrossbowItem.java +++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java -@@ -217,6 +217,7 @@ public class CrossbowItem extends ProjectileWeaponItem implements Vanishable { - - if (flag1) { - object = new FireworkRocketEntity(world, projectile, shooter, shooter.getX(), shooter.getEyeY() - 0.15000000596046448D, shooter.getZ(), true); -+ ((FireworkRocketEntity) object).spawningEntity = shooter.getUUID(); // Paper - } else { - object = CrossbowItem.getArrow(world, shooter, crossbow, projectile); - if (creative || simulated != 0.0F) { +@@ -147,7 +147,11 @@ public class CrossbowItem extends ProjectileWeaponItem { + @Override + protected Projectile createProjectile(Level world, LivingEntity shooter, ItemStack weaponStack, ItemStack projectileStack, boolean critical) { + if (projectileStack.is(Items.FIREWORK_ROCKET)) { +- return new FireworkRocketEntity(world, projectileStack, shooter, shooter.getX(), shooter.getEyeY() - 0.15F, shooter.getZ(), true); ++ // Paper start ++ FireworkRocketEntity entity = new FireworkRocketEntity(world, projectileStack, shooter, shooter.getX(), shooter.getEyeY() - 0.15F, shooter.getZ(), true); ++ entity.spawningEntity = shooter.getUUID(); // Paper ++ return entity; ++ // Paper end + } else { + Projectile projectile = super.createProjectile(world, shooter, weaponStack, projectileStack, critical); + if (projectile instanceof AbstractArrow abstractArrow) { diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index b342d23692ffd38b6eec66838162e9012f29ac09..3749cfca8f007973d1a2206d8f2ba15283a550e1 100644 +index da89ccaf91e2baa7caa15681c113bc283f40cd21..38b33eb92d21d0099285a304c6e064bbf56db4eb 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -53,6 +53,7 @@ public class FireworkRocketItem extends Item { +@@ -42,6 +42,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem { vec3.z + (double)direction.getStepZ() * 0.15, itemStack ); @@ -67,14 +72,14 @@ index b342d23692ffd38b6eec66838162e9012f29ac09..3749cfca8f007973d1a2206d8f2ba152 level.addFreshEntity(fireworkRocketEntity); itemStack.shrink(1); } -@@ -66,6 +67,7 @@ public class FireworkRocketItem extends Item { +@@ -55,6 +56,7 @@ public class FireworkRocketItem extends Item implements ProjectileItem { ItemStack itemStack = user.getItemInHand(hand); if (!world.isClientSide) { FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user); + fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper world.addFreshEntity(fireworkRocketEntity); - if (!user.getAbilities().instabuild) { - itemStack.shrink(1); + itemStack.consume(1, user); + user.awardStat(Stats.ITEM_USED.get(this)); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index 5ae87c370e47c545cef27a36e40da137e1ec656b..c9e15a9d82dee935293b2e7e233f5b9b2d822448 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java diff --git a/patches/unapplied/server/0130-PlayerTeleportEndGatewayEvent.patch b/patches/server/0129-PlayerTeleportEndGatewayEvent.patch similarity index 92% rename from patches/unapplied/server/0130-PlayerTeleportEndGatewayEvent.patch rename to patches/server/0129-PlayerTeleportEndGatewayEvent.patch index 250433d156..b63f7764ee 100644 --- a/patches/unapplied/server/0130-PlayerTeleportEndGatewayEvent.patch +++ b/patches/server/0129-PlayerTeleportEndGatewayEvent.patch @@ -7,10 +7,10 @@ Allows you to access the Gateway being used in a teleport event Fix the offset used for player teleportation diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -index 9e0da9a5ca64c67da5c07989f9c1872fbc2a5d26..1606c8c0dd5e27b42d0fd9da0db8a02e50efc5f9 100644 +index 45aca9747557a94ac3e60ee9f23c30abb2367bff..9690416c2ffa7d1b7607d21ae0a990dcbcbcddae 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java -@@ -208,11 +208,11 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { +@@ -202,11 +202,11 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { // CraftBukkit start - Fire PlayerTeleportEvent/EntityTeleportEvent if (entity1 instanceof ServerPlayer) { org.bukkit.craftbukkit.entity.CraftPlayer player = (CraftPlayer) entity1.getBukkitEntity(); diff --git a/patches/unapplied/server/0131-Provide-E-TE-Chunk-count-stat-methods.patch b/patches/server/0130-Provide-E-TE-Chunk-count-stat-methods.patch similarity index 92% rename from patches/unapplied/server/0131-Provide-E-TE-Chunk-count-stat-methods.patch rename to patches/server/0130-Provide-E-TE-Chunk-count-stat-methods.patch index 980da01921..366e2db789 100644 --- a/patches/unapplied/server/0131-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/patches/server/0130-Provide-E-TE-Chunk-count-stat-methods.patch @@ -7,10 +7,10 @@ Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 926e4f9760e07ab66405132de2e96306211e5b9c..7800276dea6176ed489809d589b850252fc9333b 100644 +index b2b0dea688df220a06abd458ac47aae3d67a7797..e78f39ce95e587b84afccae0e4635171370b7323 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -114,7 +114,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -113,7 +113,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public static final int TICKS_PER_DAY = 24000; public static final int MAX_ENTITY_SPAWN_Y = 20000000; public static final int MIN_ENTITY_SPAWN_Y = -20000000; @@ -20,7 +20,7 @@ index 926e4f9760e07ab66405132de2e96306211e5b9c..7800276dea6176ed489809d589b85025 private final List pendingBlockEntityTickers = Lists.newArrayList(); private boolean tickingBlockEntities; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 95b3bcd4cfcedc358096831bc59a7effd186a063..aac9eee069b16ab70b7553c6c324149011c94f8e 100644 +index c793bae3d7c6da5014862c98b08fc3fa2374866d..b42d482defda5a91f4e625308d5fec8c8369e5fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -164,6 +164,56 @@ public class CraftWorld extends CraftRegionAccessor implements World { diff --git a/patches/unapplied/server/0132-Enforce-Sync-Player-Saves.patch b/patches/server/0131-Enforce-Sync-Player-Saves.patch similarity index 87% rename from patches/unapplied/server/0132-Enforce-Sync-Player-Saves.patch rename to patches/server/0131-Enforce-Sync-Player-Saves.patch index 398e56eb2c..8c69fb296d 100644 --- a/patches/unapplied/server/0132-Enforce-Sync-Player-Saves.patch +++ b/patches/server/0131-Enforce-Sync-Player-Saves.patch @@ -7,10 +7,10 @@ Saving players async is extremely dangerous. This will force it to main the same way we handle async chunk loads. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e1d9f11a9d5333811fc8cb5dd95c0ca79fd3543c..e45568112220b246adf3efdc43d26258336efbf9 100644 +index fa85bf581ff2ff8de50355c3b5bf74d38ef9ffc1..2b8824242b0e6e0224d6eac8f661ae1435c58d66 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1062,11 +1062,13 @@ public abstract class PlayerList { +@@ -1060,11 +1060,13 @@ public abstract class PlayerList { } public void saveAll() { diff --git a/patches/unapplied/server/0133-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0132-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch similarity index 88% rename from patches/unapplied/server/0133-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch rename to patches/server/0132-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 698992e2b7..5a6cb6d9be 100644 --- a/patches/unapplied/server/0133-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0132-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -8,10 +8,10 @@ Adds lots of information about why this orb exists. Replaces isFromBottle() with logic that persists entity reloads too. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -index 4f3c82f1b5ae24d5f70318fa96fae2a58ce7fd9f..45236a077d798d6a257a2e982b58901167ecd06e 100644 +index 344d22ae4067bccd6d42b444f6b057c9d1ea6e82..f4bf927477af23365a2d4618a1634195bd2054c8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -427,7 +427,7 @@ public class ServerPlayerGameMode { +@@ -430,7 +430,7 @@ public class ServerPlayerGameMode { // Drop event experience if (flag && event != null) { @@ -21,10 +21,10 @@ index 4f3c82f1b5ae24d5f70318fa96fae2a58ce7fd9f..45236a077d798d6a257a2e982b589011 return true; diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 7ce46bd254e0f14b1bbafe37e0eb97a468a07083..00b46fd0b4a718756f8b21f203fd5679bc2a79d8 100644 +index 1f29ed95ef3d1904a014715028d9d591fe39231f..1a829f79e6f9e03ead745e13ece4d1b57195dbb4 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -40,9 +40,63 @@ public class ExperienceOrb extends Entity { +@@ -41,9 +41,63 @@ public class ExperienceOrb extends Entity { public int value; private int count; private Player followingPlayer; @@ -88,7 +88,7 @@ index 7ce46bd254e0f14b1bbafe37e0eb97a468a07083..00b46fd0b4a718756f8b21f203fd5679 this.setPos(x, y, z); this.setYRot((float) (this.random.nextDouble() * 360.0D)); this.setDeltaMovement((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D); -@@ -161,12 +215,20 @@ public class ExperienceOrb extends Entity { +@@ -167,12 +221,20 @@ public class ExperienceOrb extends Entity { } public static void award(ServerLevel world, Vec3 pos, int amount) { @@ -110,7 +110,7 @@ index 7ce46bd254e0f14b1bbafe37e0eb97a468a07083..00b46fd0b4a718756f8b21f203fd5679 } } -@@ -236,6 +298,7 @@ public class ExperienceOrb extends Entity { +@@ -242,6 +304,7 @@ public class ExperienceOrb extends Entity { nbt.putShort("Age", (short) this.age); nbt.putShort("Value", (short) this.value); nbt.putInt("Count", this.count); @@ -118,7 +118,7 @@ index 7ce46bd254e0f14b1bbafe37e0eb97a468a07083..00b46fd0b4a718756f8b21f203fd5679 } @Override -@@ -244,6 +307,7 @@ public class ExperienceOrb extends Entity { +@@ -250,6 +313,7 @@ public class ExperienceOrb extends Entity { this.age = nbt.getShort("Age"); this.value = nbt.getShort("Value"); this.count = Math.max(nbt.getInt("Count"), 1); @@ -127,10 +127,10 @@ index 7ce46bd254e0f14b1bbafe37e0eb97a468a07083..00b46fd0b4a718756f8b21f203fd5679 @Override diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index eec88cb65aae7986e53cba336f6e0bf5ff3011b3..a49d20bab5c49721fb41e2429c7fb721ef3c2f98 100644 +index 399c12a2b14df4786c8e13484a54a73ad8571410..b51f4172b7135689fcd99b380f1a78bf8e723cfa 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1795,7 +1795,8 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1813,7 +1813,8 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void dropExperience() { // CraftBukkit start - Update getExpReward() above if the removed if() changes! if (true && !(this instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time @@ -141,10 +141,10 @@ index eec88cb65aae7986e53cba336f6e0bf5ff3011b3..a49d20bab5c49721fb41e2429c7fb721 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java -index f307f9077917f426a90523708c572b95cc7b6778..907ed82fea71254d6624eda878e2668cd26422a7 100644 +index ec112d626a189aafb148455d097919e88af7ef28..3bd13c9b8c7573726ae7defdc3c0f32876d1cf1f 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Animal.java +++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java -@@ -258,12 +258,14 @@ public abstract class Animal extends AgeableMob { +@@ -250,12 +250,14 @@ public abstract class Animal extends AgeableMob { public void finalizeSpawnChildFromBreeding(ServerLevel worldserver, Animal entityanimal, @Nullable AgeableMob entityageable, int experience) { // CraftBukkit end @@ -163,7 +163,7 @@ index f307f9077917f426a90523708c572b95cc7b6778..907ed82fea71254d6624eda878e2668c this.setAge(6000); entityanimal.setAge(6000); this.resetLove(); -@@ -272,7 +274,7 @@ public abstract class Animal extends AgeableMob { +@@ -264,7 +266,7 @@ public abstract class Animal extends AgeableMob { if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // CraftBukkit start - use event experience if (experience > 0) { @@ -173,10 +173,10 @@ index f307f9077917f426a90523708c572b95cc7b6778..907ed82fea71254d6624eda878e2668c // CraftBukkit end } diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java -index d2d89a47ceae2431969502cb81ae93391a2ee16c..6376908df89af1eff3a948ca1faef5d4925f0c3b 100644 +index 40ea9af580f841c3aba61db7c34efb88d542a547..d2dfccd1e31b2f050c9f480220cf17df71c687c3 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Fox.java +++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java -@@ -913,7 +913,7 @@ public class Fox extends Animal implements VariantHolder { +@@ -897,7 +897,7 @@ public class Fox extends Animal implements VariantHolder { if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { // CraftBukkit start - use event experience if (experience > 0) { @@ -186,10 +186,10 @@ index d2d89a47ceae2431969502cb81ae93391a2ee16c..6376908df89af1eff3a948ca1faef5d4 // CraftBukkit end } diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -index 5385f0a1d0c5522a94e2a5ded779d68826537883..11322066522a3268063bad7267ef4dd4f06d983e 100644 +index 1f6703a089df0c53d022321618a303edefcf0f77..e6bc782683ea5d69840ca7b89b20cfdc1adac5fd 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java +++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java -@@ -457,7 +457,7 @@ public class Turtle extends Animal { +@@ -455,7 +455,7 @@ public class Turtle extends Animal { RandomSource randomsource = this.animal.getRandom(); if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { @@ -199,10 +199,10 @@ index 5385f0a1d0c5522a94e2a5ded779d68826537883..11322066522a3268063bad7267ef4dd4 } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -index 0df9780c1689532d0d9f236077400b298d8e9f68..9ab60fb1b7f9c8a342d9116e99f7f0a1e463a626 100644 +index 993ccde9e6ee769ce51cdfa4ff06cfe1bd27bbb0..963fdb4132001aa781eda45b75cb4df97d782ddc 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java -@@ -674,7 +674,7 @@ public class EnderDragon extends Mob implements Enemy { +@@ -672,7 +672,7 @@ public class EnderDragon extends Mob implements Enemy { if (this.level() instanceof ServerLevel) { if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp @@ -211,7 +211,7 @@ index 0df9780c1689532d0d9f236077400b298d8e9f68..9ab60fb1b7f9c8a342d9116e99f7f0a1 } if (this.dragonDeathTime == 1 && !this.isSilent()) { -@@ -703,7 +703,7 @@ public class EnderDragon extends Mob implements Enemy { +@@ -701,7 +701,7 @@ public class EnderDragon extends Mob implements Enemy { this.move(MoverType.SELF, new Vec3(0.0D, 0.10000000149011612D, 0.0D)); if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel) { if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp @@ -221,10 +221,10 @@ index 0df9780c1689532d0d9f236077400b298d8e9f68..9ab60fb1b7f9c8a342d9116e99f7f0a1 if (this.dragonFight != null) { diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index e7db715d45d27cbc9b3ed7cad1d907273b225c7f..0b34003058205f26a89d18dad06b2067dbe897d7 100644 +index 0da329781f0afd4ec4a731889b892afe7e399d21..d1c3f5d076a3d560d02553d6a33e5890d0c2bfc7 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -639,7 +639,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -632,7 +632,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } if (offer.shouldRewardExp()) { @@ -234,10 +234,10 @@ index e7db715d45d27cbc9b3ed7cad1d907273b225c7f..0b34003058205f26a89d18dad06b2067 } diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -index 09448ca61b7d1faf3b2f83d7c9f8a14afee39b7b..6b8d6ae203b7f7f2b591c35586baa4e8951a3677 100644 +index c493c324a2606a40a3a04a55cb77790614d2707b..057eca881d279c610e933ebff5fb654625b036be 100644 --- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java +++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java -@@ -208,7 +208,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill +@@ -207,7 +207,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill if (offer.shouldRewardExp()) { int i = 3 + this.random.nextInt(4); @@ -247,10 +247,10 @@ index 09448ca61b7d1faf3b2f83d7c9f8a14afee39b7b..6b8d6ae203b7f7f2b591c35586baa4e8 } diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -index 9bf5b67922f3368e1ee4d76f6297ebe425f3ceab..d7548eb7cd6986dcea6fbf4efb76b647cc350642 100644 +index 6b3cf71d7ced6405308b41ac316040bcc03f654d..453da998a98eabe5a55a968277b71bd9998f3221 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java -@@ -523,7 +523,7 @@ public class FishingHook extends Projectile { +@@ -524,7 +524,7 @@ public class FishingHook extends Projectile { this.level().addFreshEntity(entityitem); // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop() if (playerFishEvent.getExpToDrop() > 0) { @@ -260,7 +260,7 @@ index 9bf5b67922f3368e1ee4d76f6297ebe425f3ceab..d7548eb7cd6986dcea6fbf4efb76b647 // CraftBukkit end if (itemstack1.is(ItemTags.FISHES)) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java -index fdab4a51ec7068047e899771aad1b9949a0113cb..7e46b1958f1139b3a97a5f11e06c6f85172d6192 100644 +index 9963db38420b91ae817a18ff084311cb45c0edee..70ceef96c6305324aef3b006f6603817ef187e9f 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java @@ -54,7 +54,7 @@ public class ThrownExperienceBottle extends ThrowableItemProjectile { @@ -273,7 +273,7 @@ index fdab4a51ec7068047e899771aad1b9949a0113cb..7e46b1958f1139b3a97a5f11e06c6f85 } diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index 8d09c134058e55a23df4e23d965a7a783aed701e..45242f0ed5a0f98953df5f27fb76874d2d9e3473 100644 +index 4e3c70f7cff0235dd58414e258567ef07661f53f..d41197db6bbf9e17b67bb1faa5d370eea0212bd3 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java @@ -97,7 +97,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { @@ -286,10 +286,10 @@ index 8d09c134058e55a23df4e23d965a7a783aed701e..45242f0ed5a0f98953df5f27fb76874d world.levelEvent(1042, blockposition, 0); diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index 756a8ae14ffc46d6ebe0a858a03fb2e89b8e118a..89a62fbeeb78c864938a1cea84178478c6dc1b34 100644 +index 946001c57c326f2d2f0677bca954e8558f1c851b..ed336112581ac77196ed3e60dc8aaf50312c078b 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -369,8 +369,13 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -361,8 +361,13 @@ public class Block extends BlockBehaviour implements ItemLike { } public void popExperience(ServerLevel world, BlockPos pos, int size) { @@ -305,10 +305,10 @@ index 756a8ae14ffc46d6ebe0a858a03fb2e89b8e118a..89a62fbeeb78c864938a1cea84178478 } diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 65e7dcace8607c4d15938c697c882761c067f08e..7a13042631bea761952490cfd14dc20147405161 100644 +index 8bda1a42907132b1f3289f860530ded0a4e61f93..70e068c3d0f72f31df749add2c57450f793524ae 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -651,7 +651,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -630,7 +630,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit j = event.getExpToDrop(); // CraftBukkit end @@ -318,10 +318,10 @@ index 65e7dcace8607c4d15938c697c882761c067f08e..7a13042631bea761952490cfd14dc201 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java -index c5547988e8e4ec5f1d090d264e14556f490d4e31..c3a55347b630c57aa36f9c761e1937dc95027bb7 100644 +index 52d4eaf7c92b9b4252e0cae25128b5ae7b0092cc..3bbd314d94de3736e039b4b2d836afa8cc892511 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java -@@ -363,7 +363,7 @@ public final class CraftEntityTypes { +@@ -371,7 +371,7 @@ public final class CraftEntityTypes { return item; })); register(new EntityTypeData<>(EntityType.EXPERIENCE_ORB, ExperienceOrb.class, CraftExperienceOrb::new, diff --git a/patches/unapplied/server/0134-Cap-Entity-Collisions.patch b/patches/server/0133-Cap-Entity-Collisions.patch similarity index 85% rename from patches/unapplied/server/0134-Cap-Entity-Collisions.patch rename to patches/server/0133-Cap-Entity-Collisions.patch index a84c864799..3178a0a8f1 100644 --- a/patches/unapplied/server/0134-Cap-Entity-Collisions.patch +++ b/patches/server/0133-Cap-Entity-Collisions.patch @@ -12,10 +12,10 @@ just as it does in Vanilla, but entity pushing logic will be capped. You can set this to 0 to disable collisions. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a6a97dca29c900278885b5ab1741229fcfaf7b36..6d31ced629fabef4de2ef9a26586cea0cffa155c 100644 +index 10687787a5fd1a81ad5a625848db4649381eab67..9f906e51f236e84f6cee8eba4b7587edee7ce796 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -394,6 +394,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -396,6 +396,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public long activatedTick = Integer.MIN_VALUE; public void inactiveTick() { } // Spigot end @@ -24,10 +24,10 @@ index a6a97dca29c900278885b5ab1741229fcfaf7b36..6d31ced629fabef4de2ef9a26586cea0 @javax.annotation.Nullable private org.bukkit.util.Vector origin; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index a49d20bab5c49721fb41e2429c7fb721ef3c2f98..589fba7264d8041e6f766779fe8e3d5071398fed 100644 +index b51f4172b7135689fcd99b380f1a78bf8e723cfa..177ad43b62c6e1efc0ae6298e464debdf66b1055 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3369,10 +3369,12 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3454,10 +3454,12 @@ public abstract class LivingEntity extends Entity implements Attackable { } Iterator iterator1 = list.iterator(); diff --git a/patches/unapplied/server/0135-Remove-CraftScheduler-Async-Task-Debugger.patch b/patches/server/0134-Remove-CraftScheduler-Async-Task-Debugger.patch similarity index 100% rename from patches/unapplied/server/0135-Remove-CraftScheduler-Async-Task-Debugger.patch rename to patches/server/0134-Remove-CraftScheduler-Async-Task-Debugger.patch diff --git a/patches/unapplied/server/0136-Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/0135-Properly-handle-async-calls-to-restart-the-server.patch similarity index 95% rename from patches/unapplied/server/0136-Properly-handle-async-calls-to-restart-the-server.patch rename to patches/server/0135-Properly-handle-async-calls-to-restart-the-server.patch index a7eecd2511..a6a5c49d44 100644 --- a/patches/unapplied/server/0136-Properly-handle-async-calls-to-restart-the-server.patch +++ b/patches/server/0135-Properly-handle-async-calls-to-restart-the-server.patch @@ -30,10 +30,10 @@ will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 04cc2b69336ceb463910c081119f3188d8c426d3..fa1a6c2f1c11506243cfc61b519bef578e5627fc 100644 +index 1ecd28b709e3ef47568298878a84a6aede52d6f5..9cbe8415699a79344b3c4245cc4f9424b7df3b2a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -236,6 +236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> levels; private PlayerList playerList; private volatile boolean running; @@ -41,7 +41,7 @@ index 04cc2b69336ceb463910c081119f3188d8c426d3..fa1a6c2f1c11506243cfc61b519bef57 private boolean stopped; private int tickCount; private int ticksUntilAutosave; -@@ -919,7 +920,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0.5F || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) { diff --git a/patches/unapplied/server/0138-Add-configuration-option-to-prevent-player-names-fro.patch b/patches/server/0137-Add-configuration-option-to-prevent-player-names-fro.patch similarity index 83% rename from patches/unapplied/server/0138-Add-configuration-option-to-prevent-player-names-fro.patch rename to patches/server/0137-Add-configuration-option-to-prevent-player-names-fro.patch index 0c9e8ad802..9d390326d1 100644 --- a/patches/unapplied/server/0138-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/patches/server/0137-Add-configuration-option-to-prevent-player-names-fro.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration option to prevent player names from being diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9978f3ffb3803b7f9278d49a688bc2d4bf740cf3..827579f59d34b61912a67b40624f0f41524185fd 100644 +index c49dfa14a95b495a615fcf2d400a1630f7a698dd..f6012feafe1dbbf9c52ac38965d9475896766657 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2773,5 +2773,10 @@ public final class CraftServer implements Server { +@@ -2796,5 +2796,10 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); return true; } diff --git a/patches/unapplied/server/0140-provide-a-configurable-option-to-disable-creeper-lin.patch b/patches/server/0138-provide-a-configurable-option-to-disable-creeper-lin.patch similarity index 86% rename from patches/unapplied/server/0140-provide-a-configurable-option-to-disable-creeper-lin.patch rename to patches/server/0138-provide-a-configurable-option-to-disable-creeper-lin.patch index 98fcd80dba..5d6a56dbae 100644 --- a/patches/unapplied/server/0140-provide-a-configurable-option-to-disable-creeper-lin.patch +++ b/patches/server/0138-provide-a-configurable-option-to-disable-creeper-lin.patch @@ -6,10 +6,10 @@ Subject: [PATCH] provide a configurable option to disable creeper lingering diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -index 2c2dbe18e7c3c7fa9c98aaa619637f399e83f72e..79614aaa4832c969443d6393e7d5bb8a622a5d98 100644 +index 3b496eaac4eaadadb3f366f4121ce899aa212532..01938fc75158c13c4b040fa623934ec841cbf719 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java +++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java -@@ -288,7 +288,7 @@ public class Creeper extends Monster implements PowerableMob { +@@ -286,7 +286,7 @@ public class Creeper extends Monster implements PowerableMob { private void spawnLingeringCloud() { Collection collection = this.getActiveEffects(); diff --git a/patches/unapplied/server/0141-Item-canEntityPickup.patch b/patches/server/0139-Item-canEntityPickup.patch similarity index 87% rename from patches/unapplied/server/0141-Item-canEntityPickup.patch rename to patches/server/0139-Item-canEntityPickup.patch index 4714e6c080..b230279aed 100644 --- a/patches/unapplied/server/0141-Item-canEntityPickup.patch +++ b/patches/server/0139-Item-canEntityPickup.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 2de1ad28d42d4beec69901bf985ac0be582f00b9..655dfa9113ca82dc56bc8f4b083ea049ee5b4bee 100644 +index 14d1222286c7387eca828a9380053f14e4539b3c..b740d931ad7ad81bf94afa62a9ae44a2fe9549d4 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -671,6 +671,11 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -712,6 +712,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti ItemEntity entityitem = (ItemEntity) iterator.next(); if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) { @@ -21,10 +21,10 @@ index 2de1ad28d42d4beec69901bf985ac0be582f00b9..655dfa9113ca82dc56bc8f4b083ea049 } } 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 270ae75863ff6e97e80641e94ce2ade07f683c5a..d1bd8b5e5b0873a526ae449986593867b10eec12 100644 +index 16e3bdf6a2789a0828fc9d879b441fa4bd12d428..707fe72003a254a84ceef8a0572fff52997a4129 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -55,6 +55,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -59,6 +59,7 @@ public class ItemEntity extends Entity implements TraceableEntity { public UUID target; public final float bobOffs; private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit diff --git a/patches/unapplied/server/0142-PlayerPickupItemEvent-setFlyAtPlayer.patch b/patches/server/0140-PlayerPickupItemEvent-setFlyAtPlayer.patch similarity index 87% rename from patches/unapplied/server/0142-PlayerPickupItemEvent-setFlyAtPlayer.patch rename to patches/server/0140-PlayerPickupItemEvent-setFlyAtPlayer.patch index fc6964aaae..6a32c3b05f 100644 --- a/patches/unapplied/server/0142-PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/patches/server/0140-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer 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 d1bd8b5e5b0873a526ae449986593867b10eec12..a66abc5e759ee0f170b5aadd2640613b98ef6942 100644 +index 707fe72003a254a84ceef8a0572fff52997a4129..f63d1145be7b6fb76373a4ec1423fd7cedf73b63 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -424,6 +424,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -435,6 +435,7 @@ public class ItemEntity extends Entity implements TraceableEntity { // CraftBukkit start - fire PlayerPickupItemEvent int canHold = player.getInventory().canHold(itemstack); int remaining = i - canHold; @@ -16,7 +16,7 @@ index d1bd8b5e5b0873a526ae449986593867b10eec12..a66abc5e759ee0f170b5aadd2640613b if (this.pickupDelay <= 0 && canHold > 0) { itemstack.setCount(canHold); -@@ -431,8 +432,14 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -442,8 +443,14 @@ public class ItemEntity extends Entity implements TraceableEntity { PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((Player) player.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems()); this.level().getCraftServer().getPluginManager().callEvent(playerEvent); @@ -31,7 +31,7 @@ index d1bd8b5e5b0873a526ae449986593867b10eec12..a66abc5e759ee0f170b5aadd2640613b return; } -@@ -462,6 +469,7 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -473,6 +480,7 @@ public class ItemEntity extends Entity implements TraceableEntity { // CraftBukkit end if (this.pickupDelay == 0 && (this.target == null || this.target.equals(player.getUUID())) && player.getInventory().add(itemstack)) { diff --git a/patches/unapplied/server/0143-PlayerAttemptPickupItemEvent.patch b/patches/server/0141-PlayerAttemptPickupItemEvent.patch similarity index 88% rename from patches/unapplied/server/0143-PlayerAttemptPickupItemEvent.patch rename to patches/server/0141-PlayerAttemptPickupItemEvent.patch index ccaf080546..af6c33cefe 100644 --- a/patches/unapplied/server/0143-PlayerAttemptPickupItemEvent.patch +++ b/patches/server/0141-PlayerAttemptPickupItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent 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 a66abc5e759ee0f170b5aadd2640613b98ef6942..d568726f80308e29bcfa3714728096d7d0aa822c 100644 +index f63d1145be7b6fb76373a4ec1423fd7cedf73b63..d97e12a2dca072ae102b029fb67472dacc2c5b40 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -37,6 +37,7 @@ import org.bukkit.event.entity.EntityPickupItemEvent; +@@ -39,6 +39,7 @@ import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.entity.EntityRemoveEvent; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end @@ -16,7 +16,7 @@ index a66abc5e759ee0f170b5aadd2640613b98ef6942..d568726f80308e29bcfa3714728096d7 public class ItemEntity extends Entity implements TraceableEntity { -@@ -426,6 +427,22 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -437,6 +438,22 @@ public class ItemEntity extends Entity implements TraceableEntity { int remaining = i - canHold; boolean flyAtPlayer = false; // Paper diff --git a/patches/unapplied/server/0144-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0142-Do-not-submit-profile-lookups-to-worldgen-threads.patch similarity index 85% rename from patches/unapplied/server/0144-Do-not-submit-profile-lookups-to-worldgen-threads.patch rename to patches/server/0142-Do-not-submit-profile-lookups-to-worldgen-threads.patch index 44e1a4134d..e660ce370c 100644 --- a/patches/unapplied/server/0144-Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/0142-Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -10,10 +10,10 @@ out due to a sync load, as the worldgen threads will be stalling on profile lookups. diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index bf17c2005aa71a627c93b3bbaa773a5902b897c1..3db6962b9f6f5da09694d57b7323c39f314b1327 100644 +index 9d91e7890d8cba72f0aa2ca9661f6de7ae8a0dcd..cf54e2c8e8aadb9e7343382a5ba59c657234c9b9 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -91,6 +91,22 @@ public class Util { +@@ -93,6 +93,22 @@ public class Util { private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false); private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true); @@ -34,10 +34,10 @@ index bf17c2005aa71a627c93b3bbaa773a5902b897c1..3db6962b9f6f5da09694d57b7323c39f + }); + // Paper end - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread private static final DateTimeFormatter FILENAME_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss", Locale.ROOT); - private static final int LINEAR_LOOKUP_THRESHOLD = 8; + public static final int LINEAR_LOOKUP_THRESHOLD = 8; public static final long NANOS_PER_MILLI = 1000000L; diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index 92c22dc10e385f1942f2ec375bbce9faf257462b..adb472c175cc6f6ced7075a37423d6c898fd5ccb 100644 +index aeb0c7ce9b6f93dadd407dbdefba053568f2e2fe..416b26c2ab62b29d640169166980e398d5824b14 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -169,7 +169,7 @@ public class GameProfileCache { @@ -50,18 +50,18 @@ index 92c22dc10e385f1942f2ec375bbce9faf257462b..adb472c175cc6f6ced7075a37423d6c8 }, this.executor); diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -index bffc770105800ba78c6d9bfb56ad9ad425f19910..d0b3a836de9830a4da534bedd9f94a16a82ef9c6 100644 +index 6097e0ab387cfa4c2c9ab0389fc5bb6cd899ecc3..ebba6bc5b337d19e32be5a78294501ed8300f2bd 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -@@ -80,7 +80,7 @@ public class SkullBlockEntity extends BlockEntity { - } else { - return Optional.empty(); +@@ -105,7 +105,7 @@ public class SkullBlockEntity extends BlockEntity { + ProfileResult profileResult = apiServices.sessionService().fetchProfile(uuid, true); + return Optional.ofNullable(profileResult).map(ProfileResult::profile); } - }, Util.backgroundExecutor()); + }, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread } - @Override + public static void clear() { diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java index 358af0121ce3d87a9f51da2bae0699034c1560b4..edd340c66ea8cec1c76ba29f1deab14c4784a7e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java diff --git a/patches/unapplied/server/0145-Basic-PlayerProfile-API.patch b/patches/server/0143-Basic-PlayerProfile-API.patch similarity index 98% rename from patches/unapplied/server/0145-Basic-PlayerProfile-API.patch rename to patches/server/0143-Basic-PlayerProfile-API.patch index 86180d4842..ee847afccd 100644 --- a/patches/unapplied/server/0145-Basic-PlayerProfile-API.patch +++ b/patches/server/0143-Basic-PlayerProfile-API.patch @@ -580,10 +580,10 @@ index 722dcae9ab65bcacb9fb89dfaa63715d87816476..c57e8b6458800fe9bb27050eecc42bd3 * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index a40755f2e4d36a3ef34e187727065da4b918a5e8..d46b7bff34b9b43e895f713d2e73071bc62de443 100644 +index 6afede80c10503a261d0f735c351d943597be9ff..993296f9c2457809bd6b844c309895f417eb42a5 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -165,7 +165,7 @@ public class Main { +@@ -168,7 +168,7 @@ public class Main { } File file = (File) optionset.valueOf("universe"); // CraftBukkit @@ -593,7 +593,7 @@ index a40755f2e4d36a3ef34e187727065da4b918a5e8..d46b7bff34b9b43e895f713d2e73071b String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/src/main/java/net/minecraft/server/players/GameProfileCache.java -index adb472c175cc6f6ced7075a37423d6c898fd5ccb..1ec0f3a7148c2f412421772f6e1dff0bb92a51bc 100644 +index 416b26c2ab62b29d640169166980e398d5824b14..774d81c702edb76a2f6184d4dc53687de6734a79 100644 --- a/src/main/java/net/minecraft/server/players/GameProfileCache.java +++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java @@ -126,6 +126,17 @@ public class GameProfileCache { @@ -615,10 +615,10 @@ index adb472c175cc6f6ced7075a37423d6c898fd5ccb..1ec0f3a7148c2f412421772f6e1dff0b String s1 = name.toLowerCase(Locale.ROOT); GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f7d937c6a11e24afe767411428210f3c042a6f78..eb3bb76cf141991acd6a384bf461719de8392754 100644 +index f6012feafe1dbbf9c52ac38965d9475896766657..a7554f2028f93867360c27a51c9580a8b49f5b57 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -262,6 +262,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; +@@ -264,6 +264,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; import net.md_5.bungee.api.chat.BaseComponent; // Spigot @@ -628,15 +628,15 @@ index f7d937c6a11e24afe767411428210f3c042a6f78..eb3bb76cf141991acd6a384bf461719d public final class CraftServer implements Server { private final String serverName = "Paper"; // Paper private final String serverVersion; -@@ -305,6 +308,7 @@ public final class CraftServer implements Server { +@@ -307,6 +310,7 @@ public final class CraftServer implements Server { static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); ConfigurationSerialization.registerClass(CraftPlayerProfile.class); + ConfigurationSerialization.registerClass(com.destroystokyo.paper.profile.CraftPlayerProfile.class); // Paper CraftItemFactory.instance(); + CraftEntityFactory.instance(); } - -@@ -2782,5 +2786,42 @@ public final class CraftServer implements Server { +@@ -2801,5 +2805,42 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; } diff --git a/patches/unapplied/server/0146-Add-UnknownCommandEvent.patch b/patches/server/0144-Add-UnknownCommandEvent.patch similarity index 91% rename from patches/unapplied/server/0146-Add-UnknownCommandEvent.patch rename to patches/server/0144-Add-UnknownCommandEvent.patch index 032fb0b09f..511d581613 100644 --- a/patches/unapplied/server/0146-Add-UnknownCommandEvent.patch +++ b/patches/server/0144-Add-UnknownCommandEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add UnknownCommandEvent Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index f6938c35ac6f6116084d3e7ec9cdc918f20b6f61..edf49f2d9921b4517fb98929d842f7a62c5549df 100644 +index ec34e402104d7a696ea95e0b11ee70189b678ab9..d9fc3c25bef251df6a53ee47ec224b07240a931c 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java -@@ -334,8 +334,13 @@ public class CommandSourceStack implements ExecutionCommandSource dispatcher = new com.mojang.brigadier.CommandDispatcher(); @@ -36,7 +36,7 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..15a5059994371da4850adcf726034a71 public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) { this(); // CraftBukkit -@@ -254,6 +255,7 @@ public class Commands { +@@ -257,6 +258,7 @@ public class Commands { if (environment.includeIntegrated) { PublishCommand.register(this.dispatcher); } @@ -44,16 +44,16 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..15a5059994371da4850adcf726034a71 // CraftBukkit start } -@@ -328,7 +330,7 @@ public class Commands { +@@ -331,7 +333,7 @@ public class Commands { commandlistenerwrapper.getServer().getProfiler().push(() -> { return "/" + s; }); -- ContextChain contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit +- ContextChain contextchain = Commands.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit + ContextChain contextchain = this.finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit // Paper - Add UnknownCommandEvent try { if (contextchain != null) { -@@ -362,14 +364,23 @@ public class Commands { +@@ -365,14 +367,23 @@ public class Commands { } @Nullable @@ -79,7 +79,7 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..15a5059994371da4850adcf726034a71 if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) { int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor()); MutableComponent ichatmutablecomponent = Component.empty().withStyle(ChatFormatting.GRAY).withStyle((chatmodifier) -> { -@@ -388,7 +399,18 @@ public class Commands { +@@ -391,7 +402,18 @@ public class Commands { } ichatmutablecomponent.append((Component) Component.translatable("command.context.here").withStyle(ChatFormatting.RED, ChatFormatting.ITALIC)); @@ -100,7 +100,7 @@ index 495a7b713a7ab9c19aad34512b76523bad43b89d..15a5059994371da4850adcf726034a71 return null; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index eb3bb76cf141991acd6a384bf461719de8392754..b6e6b4213e893fac64855cc4b4e6eeb4246050d1 100644 +index a7554f2028f93867360c27a51c9580a8b49f5b57..f351667cec83f39c28073e262b6c9b51873fb327 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -529,6 +529,7 @@ public final class CraftServer implements Server { diff --git a/patches/unapplied/server/0147-Shoulder-Entities-Release-API.patch b/patches/server/0145-Shoulder-Entities-Release-API.patch similarity index 92% rename from patches/unapplied/server/0147-Shoulder-Entities-Release-API.patch rename to patches/server/0145-Shoulder-Entities-Release-API.patch index 878ba52040..5cffe32839 100644 --- a/patches/unapplied/server/0147-Shoulder-Entities-Release-API.patch +++ b/patches/server/0145-Shoulder-Entities-Release-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 7429df8c6f29f7216e33cde3226424936de97cf9..4bbf8bb418e3585be2efce5d9a8785faafe7cdde 100644 +index 4ac2d47df8e805b4f895951e839a0af8df7127cc..e292c1ab45d2618c4e852875107ec1819dba85c4 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1956,20 +1956,45 @@ public abstract class Player extends LivingEntity { +@@ -1982,20 +1982,45 @@ public abstract class Player extends LivingEntity { } @@ -59,10 +59,10 @@ index 7429df8c6f29f7216e33cde3226424936de97cf9..4bbf8bb418e3585be2efce5d9a8785fa @Override public abstract boolean isSpectator(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 4d92ca5b580e66e78b592bc0de1078dc10a85f39..2cb3c0b96b769c395f7fecbeebba0ff2a33b692d 100644 +index 1010ac55d91559bcb6ebadeea447f32c6aa89226..47350439f579ef2ab408bda0fc4b8976df3a5b92 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -513,6 +513,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -511,6 +511,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { this.getHandle().getCooldowns().addCooldown(CraftItemType.bukkitToMinecraft(material), ticks); } diff --git a/patches/unapplied/server/0148-Profile-Lookup-Events.patch b/patches/server/0146-Profile-Lookup-Events.patch similarity index 100% rename from patches/unapplied/server/0148-Profile-Lookup-Events.patch rename to patches/server/0146-Profile-Lookup-Events.patch diff --git a/patches/unapplied/server/0149-Block-player-logins-during-server-shutdown.patch b/patches/server/0147-Block-player-logins-during-server-shutdown.patch similarity index 88% rename from patches/unapplied/server/0149-Block-player-logins-during-server-shutdown.patch rename to patches/server/0147-Block-player-logins-during-server-shutdown.patch index 3de7220f12..61027e8fd1 100644 --- a/patches/unapplied/server/0149-Block-player-logins-during-server-shutdown.patch +++ b/patches/server/0147-Block-player-logins-during-server-shutdown.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block player logins during server shutdown diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index c5b451a706240dbd6719e001825c6859fc1b2a49..33bd60b5ef7383061acf2da24cfee35b495ebfc7 100644 +index b03d4f12e89b8a5fe6ad2282f8cc2909b87795a9..93df138ffdf45303ce28ef6bff462b1b14e27f61 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -74,6 +74,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -95,6 +95,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, @Override public void tick() { diff --git a/patches/unapplied/server/0150-Entity-fromMobSpawner.patch b/patches/server/0148-Entity-fromMobSpawner.patch similarity index 79% rename from patches/unapplied/server/0150-Entity-fromMobSpawner.patch rename to patches/server/0148-Entity-fromMobSpawner.patch index 71a54b17f9..dc08de6d4b 100644 --- a/patches/unapplied/server/0150-Entity-fromMobSpawner.patch +++ b/patches/server/0148-Entity-fromMobSpawner.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6d31ced629fabef4de2ef9a26586cea0cffa155c..0cc82ffdcebbdd92fa953e7c52a20911f46a503c 100644 +index 9f906e51f236e84f6cee8eba4b7587edee7ce796..e612921a7fb68dd74d8fd4084a8beccc299ff6ea 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -395,6 +395,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -397,6 +397,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void inactiveTick() { } // Spigot end protected int numCollisions = 0; // Paper - Cap entity collisions @@ -16,7 +16,7 @@ index 6d31ced629fabef4de2ef9a26586cea0cffa155c..0cc82ffdcebbdd92fa953e7c52a20911 // Paper start - Entity origin API @javax.annotation.Nullable private org.bukkit.util.Vector origin; -@@ -2162,6 +2163,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2190,6 +2191,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index 6d31ced629fabef4de2ef9a26586cea0cffa155c..0cc82ffdcebbdd92fa953e7c52a20911 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -2302,6 +2307,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -2330,6 +2335,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.originWorld = originWorld; origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2)); } @@ -37,10 +37,10 @@ index 6d31ced629fabef4de2ef9a26586cea0cffa155c..0cc82ffdcebbdd92fa953e7c52a20911 } 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 a46293dafeb73f9206b92a2850df18a6a5f688b4..487e4211d6486d2b3052c931c27cee9729e7841b 100644 +index aa54237205989f619ac6a3faa2e4285427b9e31d..43d399e1a0ba2fb0541f851a28032fa60fc01b33 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -167,6 +167,7 @@ public abstract class BaseSpawner { +@@ -176,6 +176,7 @@ public abstract class BaseSpawner { // Spigot End } @@ -49,10 +49,10 @@ index a46293dafeb73f9206b92a2850df18a6a5f688b4..487e4211d6486d2b3052c931c27cee97 if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { continue; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 1be5c322abcec8ec32b84dec02d386e53cb5e16a..4808c62d3d951b201061659c91d1001e4b9b49ef 100644 +index 3390033bbfc8fd0715458e5faa6a65477272a80b..88e0ac38214c537ea8be5d23a17ac5a58acd3682 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -983,4 +983,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -993,4 +993,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return originVector.toLocation(world); } // Paper end - entity origin API diff --git a/patches/unapplied/server/0151-Improve-the-Saddle-API-for-Horses.patch b/patches/server/0149-Improve-the-Saddle-API-for-Horses.patch similarity index 96% rename from patches/unapplied/server/0151-Improve-the-Saddle-API-for-Horses.patch rename to patches/server/0149-Improve-the-Saddle-API-for-Horses.patch index c529ffab64..0621160522 100644 --- a/patches/unapplied/server/0151-Improve-the-Saddle-API-for-Horses.patch +++ b/patches/server/0149-Improve-the-Saddle-API-for-Horses.patch @@ -7,7 +7,7 @@ Not all horses with Saddles have armor. This lets us break up the horses with sa and access their saddle state separately from an interface shared with Armor. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -index 8093e2bebd17d7a02d6df8882bc1ac000ca8b21c..81c34b5245133cdd119f36c6bc084fb8d99f97f8 100644 +index 3b7a355945adbc671b1c3b6381e6fbbcb9fe7294..5192fa2aeba7833fca456bded0deedde7de03506 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java @@ -5,6 +5,7 @@ import java.util.UUID; diff --git a/patches/server/0150-ensureServerConversions-API.patch b/patches/server/0150-ensureServerConversions-API.patch new file mode 100644 index 0000000000..d9fa74bf9d --- /dev/null +++ b/patches/server/0150-ensureServerConversions-API.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 4 May 2016 22:43:12 -0400 +Subject: [PATCH] ensureServerConversions API + +This will take a Bukkit ItemStack and run it through any conversions a server process would perform on it, +to ensure it meets latest minecraft expectations. + +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +index e5ee4a2e5cca2fd3a74ac58335ccf589ab87c9c5..74c8f8540340be6d7d26bbecfe07c6ce3ed019ad 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +@@ -514,4 +514,12 @@ public final class CraftItemFactory implements ItemFactory { + return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName()); + } + // Paper end - Adventure ++ ++ // Paper start - ensure server conversions API ++ // TODO: DO WE NEED THIS? ++ @Override ++ public ItemStack ensureServerConversions(ItemStack item) { ++ return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); ++ } ++ // Paper end - ensure server conversions API + } diff --git a/patches/unapplied/server/0153-Implement-getI18NDisplayName.patch b/patches/server/0151-Implement-getI18NDisplayName.patch similarity index 89% rename from patches/unapplied/server/0153-Implement-getI18NDisplayName.patch rename to patches/server/0151-Implement-getI18NDisplayName.patch index 0b1d065a44..21bed43a44 100644 --- a/patches/unapplied/server/0153-Implement-getI18NDisplayName.patch +++ b/patches/server/0151-Implement-getI18NDisplayName.patch @@ -8,10 +8,10 @@ Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 89bc6cb62123bc17d579b578c4d1d2e5f8c40837..71db89105c70cb70726fb6a732b899297aeee82a 100644 +index 74c8f8540340be6d7d26bbecfe07c6ce3ed019ad..fc51a93785ffc464d2719b440f49022f24b3983a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -512,4 +512,19 @@ public final class CraftItemFactory implements ItemFactory { +@@ -522,4 +522,19 @@ public final class CraftItemFactory implements ItemFactory { return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); } // Paper end - ensure server conversions API diff --git a/patches/unapplied/server/0154-ProfileWhitelistVerifyEvent.patch b/patches/server/0152-ProfileWhitelistVerifyEvent.patch similarity index 93% rename from patches/unapplied/server/0154-ProfileWhitelistVerifyEvent.patch rename to patches/server/0152-ProfileWhitelistVerifyEvent.patch index 759f285156..cd44d92ad3 100644 --- a/patches/unapplied/server/0154-ProfileWhitelistVerifyEvent.patch +++ b/patches/server/0152-ProfileWhitelistVerifyEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e35e202d49f01c0c97b8c3e41a14254cbd4f2c49..d2002567e10883bcf61a2036cea1b598aacc00da 100644 +index d42795278a54552410cd72d5cca636040a692971..96c9b8e3f26054ca0e285dc188cd79d121e29afd 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -632,9 +632,9 @@ public abstract class PlayerList { +@@ -631,9 +631,9 @@ public abstract class PlayerList { // return chatmessage; event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure @@ -21,7 +21,7 @@ index e35e202d49f01c0c97b8c3e41a14254cbd4f2c49..d2002567e10883bcf61a2036cea1b598 } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); -@@ -1025,7 +1025,23 @@ public abstract class PlayerList { +@@ -1024,7 +1024,23 @@ public abstract class PlayerList { } public boolean isWhiteListed(GameProfile profile) { diff --git a/patches/unapplied/server/0155-Fix-this-stupid-bullshit.patch b/patches/server/0153-Fix-this-stupid-bullshit.patch similarity index 87% rename from patches/unapplied/server/0155-Fix-this-stupid-bullshit.patch rename to patches/server/0153-Fix-this-stupid-bullshit.patch index 67c72e7d54..0ac6601973 100644 --- a/patches/unapplied/server/0155-Fix-this-stupid-bullshit.patch +++ b/patches/server/0153-Fix-this-stupid-bullshit.patch @@ -9,10 +9,10 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa and to provide some level of hint without being disruptive. diff --git a/src/main/java/net/minecraft/server/Bootstrap.java b/src/main/java/net/minecraft/server/Bootstrap.java -index 8ff786c366332588a2df053438f23cc9fb7e2b84..c887d34171f89c731d76c4ca92c70be2b1edc1e6 100644 +index d0d95d729853fc296c4931a2f73a3fc5f94302c9..05f4be8dfff37ab6804a2d990b1f8c430d42dc7c 100644 --- a/src/main/java/net/minecraft/server/Bootstrap.java +++ b/src/main/java/net/minecraft/server/Bootstrap.java -@@ -45,7 +45,7 @@ public class Bootstrap { +@@ -44,7 +44,7 @@ public class Bootstrap { public static void bootStrap() { if (!Bootstrap.isBootstrapped) { // CraftBukkit start @@ -21,7 +21,7 @@ index 8ff786c366332588a2df053438f23cc9fb7e2b84..c887d34171f89c731d76c4ca92c70be2 switch (name) { case "DispenserRegistry": break; -@@ -59,7 +59,7 @@ public class Bootstrap { +@@ -58,7 +58,7 @@ public class Bootstrap { System.err.println("*** WARNING: This server jar is unsupported, use at your own risk. ***"); System.err.println("**********************************************************************"); break; @@ -31,12 +31,12 @@ index 8ff786c366332588a2df053438f23cc9fb7e2b84..c887d34171f89c731d76c4ca92c70be2 Bootstrap.isBootstrapped = true; Instant instant = Instant.now(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e5df5469f20ccffcbe9cd227df6f5c60e82206bf..d8a7287849407c4756d4ebe4b55c358970320ce3 100644 +index dc93fd6f89694d9ae3c05de9a9d427ecce564fc9..caa7fefab037a24713e9f7f15a541d47bc7655ee 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -258,10 +258,12 @@ public class Main { +@@ -259,10 +259,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -28); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/patches/unapplied/server/0156-LivingEntity-setKiller.patch b/patches/server/0154-LivingEntity-setKiller.patch similarity index 89% rename from patches/unapplied/server/0156-LivingEntity-setKiller.patch rename to patches/server/0154-LivingEntity-setKiller.patch index 24334c96fd..9fd26436ef 100644 --- a/patches/unapplied/server/0156-LivingEntity-setKiller.patch +++ b/patches/server/0154-LivingEntity-setKiller.patch @@ -7,10 +7,10 @@ Subject: [PATCH] LivingEntity#setKiller public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 75dccbdde0d116ef194aa2ced328ad3c3992204e..19f8cfe1146374169208f26632763a882291431c 100644 +index 4a2f49be0af5d88e0fe5dd8af00b77dd0da2f208..d77c31a8b41df69d11c1ce4b77975e9a38e317b3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -406,6 +406,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -405,6 +405,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return this.getHandle().lastHurtByPlayer == null ? null : (Player) this.getHandle().lastHurtByPlayer.getBukkitEntity(); } diff --git a/patches/unapplied/server/0157-Ocelot-despawns-should-honor-nametags-and-leash.patch b/patches/server/0155-Ocelot-despawns-should-honor-nametags-and-leash.patch similarity index 84% rename from patches/unapplied/server/0157-Ocelot-despawns-should-honor-nametags-and-leash.patch rename to patches/server/0155-Ocelot-despawns-should-honor-nametags-and-leash.patch index a72222c640..9dc664ab89 100644 --- a/patches/unapplied/server/0157-Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/patches/server/0155-Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ocelot despawns should honor nametags and leash diff --git a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java -index 68679cd5857240ec4bc2951fa42a0dbbd4c13ee0..4300fab61765dd224fab084d118aae7294fc9de6 100644 +index af9f6696f52b0f44f3b4f897a5dbd174034682c3..2c7491edbb60e7ec6a208ea7292cd28a3f8f9e31 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Ocelot.java +++ b/src/main/java/net/minecraft/world/entity/animal/Ocelot.java -@@ -135,7 +135,7 @@ public class Ocelot extends Animal { +@@ -133,7 +133,7 @@ public class Ocelot extends Animal { @Override public boolean removeWhenFarAway(double distanceSquared) { diff --git a/patches/unapplied/server/0158-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/patches/server/0156-Reset-spawner-timer-when-spawner-event-is-cancelled.patch similarity index 84% rename from patches/unapplied/server/0158-Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename to patches/server/0156-Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 8062dad17c..129e8461dc 100644 --- a/patches/unapplied/server/0158-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/patches/server/0156-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 487e4211d6486d2b3052c931c27cee9729e7841b..fdd1fd084c46b0220c9e7e0389e9b52e782d2878 100644 +index 43d399e1a0ba2fb0541f851a28032fa60fc01b33..31fe2faf9137ac8b1acca9a5ffc5bbcc8aab16c1 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -168,6 +168,7 @@ public abstract class BaseSpawner { +@@ -177,6 +177,7 @@ public abstract class BaseSpawner { } entity.spawnedViaMobSpawner = true; // Paper @@ -16,7 +16,7 @@ index 487e4211d6486d2b3052c931c27cee9729e7841b..fdd1fd084c46b0220c9e7e0389e9b52e // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { continue; -@@ -184,7 +185,7 @@ public abstract class BaseSpawner { +@@ -193,7 +194,7 @@ public abstract class BaseSpawner { ((Mob) entity).spawnAnim(); } diff --git a/patches/unapplied/server/0159-Allow-specifying-a-custom-authentication-servers-dow.patch b/patches/server/0157-Allow-specifying-a-custom-authentication-servers-dow.patch similarity index 90% rename from patches/unapplied/server/0159-Allow-specifying-a-custom-authentication-servers-dow.patch rename to patches/server/0157-Allow-specifying-a-custom-authentication-servers-dow.patch index 5548378079..8f5adde12a 100644 --- a/patches/unapplied/server/0159-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/patches/server/0157-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 33bd60b5ef7383061acf2da24cfee35b495ebfc7..c01596f87efd316816b597b83c3cac1dbddc22c2 100644 +index 93df138ffdf45303ce28ef6bff462b1b14e27f61..5fb5a82edcd2c1b4ed6747d085f53b5ba0cd039f 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -262,7 +262,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -301,7 +301,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, ServerLoginPacketListenerImpl.LOGGER.warn("Authentication servers are down but will let them in anyway!"); ServerLoginPacketListenerImpl.this.startClientVerification(ServerLoginPacketListenerImpl.this.createOfflineProfile(s1)); // Spigot } else { diff --git a/patches/unapplied/server/0162-Add-PlayerJumpEvent.patch b/patches/server/0158-Add-PlayerJumpEvent.patch similarity index 89% rename from patches/unapplied/server/0162-Add-PlayerJumpEvent.patch rename to patches/server/0158-Add-PlayerJumpEvent.patch index 514f7927f6..e99610c294 100644 --- a/patches/unapplied/server/0162-Add-PlayerJumpEvent.patch +++ b/patches/server/0158-Add-PlayerJumpEvent.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6162bc5d905505be2a3570cd52c7497c6136136a..ff113cb3c11492ec09e0568f96fff40cbcd53716 100644 +index 03384eea3601869651a7539fc09a0a2d396137d2..904aab6c4c3434756e25def2acdf5ca7afebb465 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1218,7 +1218,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - boolean flag = d7 > 0.0D; +@@ -1210,7 +1210,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + boolean flag1 = d7 > 0.0D; - if (this.player.onGround() && !packet.isOnGround() && flag) { + if (this.player.onGround() && !packet.isOnGround() && flag1) { - this.player.jumpFromGround(); + // Paper start - Add PlayerJumpEvent + Player player = this.getCraftPlayer(); @@ -43,4 +43,4 @@ index 6162bc5d905505be2a3570cd52c7497c6136136a..ff113cb3c11492ec09e0568f96fff40c + // Paper end - Add PlayerJumpEvent } - boolean flag1 = this.player.verticalCollisionBelow; + boolean flag2 = this.player.verticalCollisionBelow; diff --git a/patches/unapplied/server/0163-handle-ServerboundKeepAlivePacket-async.patch b/patches/server/0159-handle-ServerboundKeepAlivePacket-async.patch similarity index 91% rename from patches/unapplied/server/0163-handle-ServerboundKeepAlivePacket-async.patch rename to patches/server/0159-handle-ServerboundKeepAlivePacket-async.patch index 0075be7038..45deff1c27 100644 --- a/patches/unapplied/server/0163-handle-ServerboundKeepAlivePacket-async.patch +++ b/patches/server/0159-handle-ServerboundKeepAlivePacket-async.patch @@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 4ff58939269f420fab18fea8fc3887e86297b99e..156cb6a00a2580eb16e05c80bc3267128b5804a3 100644 +index d9a22808381bd8b1be691cf879f5be8cc3add81c..d013b2a02a03f5637043ccc5a9c29c15cc811596 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -84,14 +84,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -105,14 +105,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @Override public void handleKeepAlive(ServerboundKeepAlivePacket packet) { diff --git a/patches/unapplied/server/0164-Expose-client-protocol-version-and-virtual-host.patch b/patches/server/0160-Expose-client-protocol-version-and-virtual-host.patch similarity index 87% rename from patches/unapplied/server/0164-Expose-client-protocol-version-and-virtual-host.patch rename to patches/server/0160-Expose-client-protocol-version-and-virtual-host.patch index 6dc2f73c03..47f54345ad 100644 --- a/patches/unapplied/server/0164-Expose-client-protocol-version-and-virtual-host.patch +++ b/patches/server/0160-Expose-client-protocol-version-and-virtual-host.patch @@ -60,10 +60,10 @@ index 0000000000000000000000000000000000000000..a5a7624f1f372a26b982836cd31cff15 + +} diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 5b267514504497de3faa7ffa490a179200d9415c..faac9ba36d83f537fe62e177c15ae237059cc5cc 100644 +index 0ccfdceea8e211c595be2dad2392876109b4eeef..1321b9adba4c9e45dce0f717d44a7cb4e64b9bf6 100644 --- a/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java -@@ -111,6 +111,10 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -120,6 +120,10 @@ public class Connection extends SimpleChannelInboundHandler> { @Nullable BandwidthDebugMonitor bandwidthDebugMonitor; public String hostname = ""; // CraftBukkit - add field @@ -75,11 +75,11 @@ index 5b267514504497de3faa7ffa490a179200d9415c..faac9ba36d83f537fe62e177c15ae237 // Paper start - add utility methods public final net.minecraft.server.level.ServerPlayer getPlayer() { diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index ce51bde4db395ff30c7d75e3badd68d6395fa40f..3dfec4462d85f3223071b4e78465587db6185f0d 100644 +index 9214fb6b8e21ff6aee8be0691f1fe6e41c901ba3..644214cc3a3c8e560b6ce470fe5997e3c10a2e3d 100644 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -165,6 +165,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - throw new UnsupportedOperationException("Invalid intention " + packet.intention()); +@@ -181,6 +181,10 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL + // Spigot End } + // Paper start - NetworkClient implementation @@ -90,11 +90,11 @@ index ce51bde4db395ff30c7d75e3badd68d6395fa40f..3dfec4462d85f3223071b4e78465587d @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7acea9cd75fcb521ff3997f4fc4cd1d34c788192..19ca1d6f6dc01ee56cb52d8d3e2c53c1549cb617 100644 +index 880fb42eb3bf43638b5a6a544aacd8b6a93d4cd9..aa08ba311a28af0806d5432423325723afb9f711 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -253,6 +253,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } +@@ -331,6 +331,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + this.getHandle().transferCookieConnection.send(new ClientboundTransferPacket(host, port)); } + // Paper start - Implement NetworkClient diff --git a/patches/unapplied/server/0165-revert-serverside-behavior-of-keepalives.patch b/patches/server/0161-revert-serverside-behavior-of-keepalives.patch similarity index 79% rename from patches/unapplied/server/0165-revert-serverside-behavior-of-keepalives.patch rename to patches/server/0161-revert-serverside-behavior-of-keepalives.patch index 27c77cb9ee..a75882c7b3 100644 --- a/patches/unapplied/server/0165-revert-serverside-behavior-of-keepalives.patch +++ b/patches/server/0161-revert-serverside-behavior-of-keepalives.patch @@ -17,17 +17,19 @@ from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 156cb6a00a2580eb16e05c80bc3267128b5804a3..d0f89a66734423ceea67fbeb99b0e72797f80e63 100644 +index d013b2a02a03f5637043ccc5a9c29c15cc811596..89c05909c10ef5172693c5d9d8fdf7e6efead53b 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -48,12 +48,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout"); +@@ -57,7 +57,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack protected final MinecraftServer server; public final Connection connection; // Paper + private final boolean transferred; - private long keepAliveTime; + private long keepAliveTime = Util.getMillis(); // Paper private boolean keepAlivePending; private long keepAliveChallenge; + private long closedListenerTime; +@@ -65,6 +65,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack private int latency; private volatile boolean suspendFlushingOnServerThread = false; public final java.util.Map packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks @@ -35,27 +37,23 @@ index 156cb6a00a2580eb16e05c80bc3267128b5804a3..d0f89a66734423ceea67fbeb99b0e727 public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit this.server = minecraftserver; -@@ -183,18 +184,25 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -215,18 +216,22 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack protected void keepConnectionAlive() { this.server.getProfiler().push("keepAlive"); - long i = Util.getMillis(); -- -- if (i - this.keepAliveTime >= 25000L) { // CraftBukkit -- if (this.keepAlivePending) { + // Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + long currentTime = Util.getMillis(); + long elapsedTime = currentTime - this.keepAliveTime; -+ -+ if (this.keepAlivePending) { -+ if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected -+ ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info + +- if (!this.isSingleplayerOwner() && i - this.keepAliveTime >= 25000L) { // CraftBukkit +- if (this.keepAlivePending) { ++ if (!this.isSingleplayerOwner() && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected ++ if (this.keepAlivePending && !this.processedDisconnect) { // Paper this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); -- } else { -+ } -+ } else { -+ if (elapsedTime >= 15000L) { // 15 seconds +- } else if (this.checkIfClosed(i)) { ++ } else if (this.checkIfClosed(currentTime)) { // Paper this.keepAlivePending = true; - this.keepAliveTime = i; - this.keepAliveChallenge = i; diff --git a/patches/server/0162-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/server/0162-Send-attack-SoundEffects-only-to-players-who-can-see.patch new file mode 100644 index 0000000000..7d1fe2ef5f --- /dev/null +++ b/patches/server/0162-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -0,0 +1,72 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Brokkonaut +Date: Tue, 31 Oct 2017 03:26:18 +0100 +Subject: [PATCH] Send attack SoundEffects only to players who can see the + attacker + + +diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java +index e292c1ab45d2618c4e852875107ec1819dba85c4..259ec0dea938758f43560b1ed7f46c1042984774 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -1243,7 +1243,7 @@ public abstract class Player extends LivingEntity { + + i += EnchantmentHelper.getKnockbackBonus(this); + if (this.isSprinting() && flag) { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + ++i; + flag1 = true; + } +@@ -1318,7 +1318,7 @@ public abstract class Player extends LivingEntity { + } + } + +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + this.sweepAttack(); + } + +@@ -1346,15 +1346,15 @@ public abstract class Player extends LivingEntity { + } + + if (flag2) { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + this.crit(target); + } + + if (!flag2 && !flag3) { + if (flag) { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + } else { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + } + } + +@@ -1406,7 +1406,7 @@ public abstract class Player extends LivingEntity { + + this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value + } else { +- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); ++ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility + if (flag4) { + target.clearFire(); + } +@@ -1812,6 +1812,14 @@ public abstract class Player extends LivingEntity { + public int getXpNeededForNextLevel() { + return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); + } ++ // Paper start - send while respecting visibility ++ private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { ++ fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself ++ if (fromEntity instanceof ServerPlayer) { ++ ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong())); ++ } ++ } ++ // Paper end - send while respecting visibility + + // CraftBukkit start + public void causeFoodExhaustion(float exhaustion) { diff --git a/patches/unapplied/server/0167-Add-PlayerArmorChangeEvent.patch b/patches/server/0163-Add-PlayerArmorChangeEvent.patch similarity index 93% rename from patches/unapplied/server/0167-Add-PlayerArmorChangeEvent.patch rename to patches/server/0163-Add-PlayerArmorChangeEvent.patch index e93b77f565..b06adec4a2 100644 --- a/patches/unapplied/server/0167-Add-PlayerArmorChangeEvent.patch +++ b/patches/server/0163-Add-PlayerArmorChangeEvent.patch @@ -5,17 +5,17 @@ Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 589fba7264d8041e6f766779fe8e3d5071398fed..96805bc64fd3593373ba9eecf29bd13d33d9e053 100644 +index 177ad43b62c6e1efc0ae6298e464debdf66b1055..45eef550358b0f3e6780d98c43c5856ff44ae313 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3068,6 +3068,13 @@ public abstract class LivingEntity extends Entity implements Attackable { - ItemStack itemstack1 = this.getItemBySlot(enumitemslot); +@@ -3137,6 +3137,13 @@ public abstract class LivingEntity extends Entity implements Attackable { + ItemStack itemstack2 = this.getItemBySlot(enumitemslot); - if (this.equipmentHasChanged(itemstack, itemstack1)) { + if (this.equipmentHasChanged(itemstack1, itemstack2)) { + // Paper start - PlayerArmorChangeEvent + if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) { -+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); ++ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack1); ++ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack2); + new com.destroystokyo.paper.event.player.PlayerArmorChangeEvent((Player) this.getBukkitEntity(), com.destroystokyo.paper.event.player.PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); + } + // Paper end - PlayerArmorChangeEvent diff --git a/patches/unapplied/server/0168-Prevent-logins-from-being-processed-when-the-player-.patch b/patches/server/0164-Prevent-logins-from-being-processed-when-the-player-.patch similarity index 73% rename from patches/unapplied/server/0168-Prevent-logins-from-being-processed-when-the-player-.patch rename to patches/server/0164-Prevent-logins-from-being-processed-when-the-player-.patch index 28f5efe52b..709139bd3b 100644 --- a/patches/unapplied/server/0168-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/patches/server/0164-Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index c01596f87efd316816b597b83c3cac1dbddc22c2..abfeaa9485b71d0b802c41bfd8e113d0bc9e9773 100644 +index 5fb5a82edcd2c1b4ed6747d085f53b5ba0cd039f..31379b0aee05862dc44f507a64f19a810e0208d5 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -81,7 +81,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -102,7 +102,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, } // Paper end - Do not allow logins while the server is shutting down if (this.state == ServerLoginPacketListenerImpl.State.VERIFYING) { @@ -18,4 +18,4 @@ index c01596f87efd316816b597b83c3cac1dbddc22c2..abfeaa9485b71d0b802c41bfd8e113d0 + } // Paper - prevent logins to be processed even though disconnect was called } - if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) { + // CraftBukkit start diff --git a/patches/unapplied/server/0169-Fix-MC-117075-Block-entity-unload-lag-spike.patch b/patches/server/0165-Fix-MC-117075-Block-entity-unload-lag-spike.patch similarity index 89% rename from patches/unapplied/server/0169-Fix-MC-117075-Block-entity-unload-lag-spike.patch rename to patches/server/0165-Fix-MC-117075-Block-entity-unload-lag-spike.patch index e5c5e50cd1..77a896be6d 100644 --- a/patches/unapplied/server/0169-Fix-MC-117075-Block-entity-unload-lag-spike.patch +++ b/patches/server/0165-Fix-MC-117075-Block-entity-unload-lag-spike.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: Block entity unload lag spike diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 7800276dea6176ed489809d589b850252fc9333b..79588b6535eb6e0d21bedc1fc5e939903b450e2f 100644 +index e78f39ce95e587b84afccae0e4635171370b7323..b650a3c8c141c8848dd3c88991f1cad7b0606adb 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -730,6 +730,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -722,6 +722,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { boolean flag = this.tickRateManager().runsNormally(); int tilesThisCycle = 0; @@ -17,7 +17,7 @@ index 7800276dea6176ed489809d589b850252fc9333b..79588b6535eb6e0d21bedc1fc5e93990 for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0; TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition); -@@ -738,12 +740,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -730,12 +732,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { if (tickingblockentity.isRemoved()) { // Spigot start tilesThisCycle--; diff --git a/patches/unapplied/server/0170-use-CB-BlockState-implementations-for-captured-block.patch b/patches/server/0166-use-CB-BlockState-implementations-for-captured-block.patch similarity index 91% rename from patches/unapplied/server/0170-use-CB-BlockState-implementations-for-captured-block.patch rename to patches/server/0166-use-CB-BlockState-implementations-for-captured-block.patch index 30982f3423..63bdff45c5 100644 --- a/patches/unapplied/server/0170-use-CB-BlockState-implementations-for-captured-block.patch +++ b/patches/server/0166-use-CB-BlockState-implementations-for-captured-block.patch @@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 79588b6535eb6e0d21bedc1fc5e939903b450e2f..232281b12fb1970fae82ce8fd3ffe1586d02bfb3 100644 +index b650a3c8c141c8848dd3c88991f1cad7b0606adb..ce2957c8955b95865c07eb3f3d7d9fcca2438e5e 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -152,7 +152,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -149,7 +149,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean preventPoiUpdated = false; // CraftBukkit - SPIGOT-5710 public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; @@ -30,7 +30,7 @@ index 79588b6535eb6e0d21bedc1fc5e939903b450e2f..232281b12fb1970fae82ce8fd3ffe158 public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>(); -@@ -390,7 +390,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -384,7 +384,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { @@ -39,7 +39,7 @@ index 79588b6535eb6e0d21bedc1fc5e939903b450e2f..232281b12fb1970fae82ce8fd3ffe158 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); this.capturedBlockStates.put(pos.immutable(), blockstate); -@@ -411,7 +411,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -405,7 +405,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit start - capture blockstates boolean captured = false; if (this.captureBlockStates && !this.capturedBlockStates.containsKey(pos)) { @@ -49,7 +49,7 @@ index 79588b6535eb6e0d21bedc1fc5e939903b450e2f..232281b12fb1970fae82ce8fd3ffe158 this.capturedBlockStates.put(pos.immutable(), blockstate); captured = true; } -@@ -612,7 +613,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -606,7 +607,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public BlockState getBlockState(BlockPos pos) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { diff --git a/patches/unapplied/server/0171-API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/0167-API-to-get-a-BlockState-without-a-snapshot.patch similarity index 88% rename from patches/unapplied/server/0171-API-to-get-a-BlockState-without-a-snapshot.patch rename to patches/server/0167-API-to-get-a-BlockState-without-a-snapshot.patch index 5b11c72288..47fbc0f82c 100644 --- a/patches/unapplied/server/0171-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/0167-API-to-get-a-BlockState-without-a-snapshot.patch @@ -13,10 +13,10 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE If Tile Entity was null, correct Sign to return empty lines instead of null diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -index 66757716b401d4f5b690c895effbbaa46f169238..53443b472d21633f49c102b330c8406c92f09d8d 100644 +index 0883e1755eae316faaeae8bf95763a0f80313c5a..90b218ebc947a1d8a8c7dfc677fe145b6386654a 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -44,6 +44,7 @@ public abstract class BlockEntity { +@@ -57,6 +57,7 @@ public abstract class BlockEntity { this.type = type; this.worldPosition = pos.immutable(); this.blockState = state; @@ -24,16 +24,16 @@ index 66757716b401d4f5b690c895effbbaa46f169238..53443b472d21633f49c102b330c8406c } public static BlockPos getPosFromTag(CompoundTag nbt) { -@@ -65,7 +66,7 @@ public abstract class BlockEntity { +@@ -78,7 +79,7 @@ public abstract class BlockEntity { // CraftBukkit start - read container - public void load(CompoundTag nbt) { + protected void loadAdditional(CompoundTag nbt, HolderLookup.Provider registryLookup) { - this.persistentDataContainer = new CraftPersistentDataContainer(BlockEntity.DATA_TYPE_REGISTRY); + this.persistentDataContainer.clear(); // Paper - clear instead of init net.minecraft.nbt.Tag persistentDataTag = nbt.get("PublicBukkitValues"); if (persistentDataTag instanceof CompoundTag) { -@@ -239,8 +240,15 @@ public abstract class BlockEntity { +@@ -342,8 +343,15 @@ public abstract class BlockEntity { // CraftBukkit start - add method public InventoryHolder getOwner() { @@ -69,10 +69,10 @@ index a1c1a101aa424e74309f6f4c0a53a6a8db5df441..013298c424025cd88f15d61e50d196f7 public Biome getBiome() { return this.getWorld().getBiome(this.getX(), this.getY(), this.getZ()); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index fa490e01d1358762eda7f41db532024fc4c7605a..e7fd9ebd47af277d6dbced0f17e954722c202776 100644 +index be9c5d928b8dccd0adde9df42ac7306153d1cc5c..fdd6f9e8164efedb3e8f29857ad35ed69e7b299d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -@@ -17,15 +17,26 @@ public class CraftBlockEntityState extends CraftBlockStat +@@ -22,15 +22,26 @@ public class CraftBlockEntityState extends CraftBlockStat private final T tileEntity; private final T snapshot; @@ -100,10 +100,10 @@ index fa490e01d1358762eda7f41db532024fc4c7605a..e7fd9ebd47af277d6dbced0f17e95472 + // Paper end } - protected CraftBlockEntityState(CraftBlockEntityState state) { -@@ -136,4 +147,11 @@ public class CraftBlockEntityState extends CraftBlockStat - public CraftBlockEntityState copy() { - return new CraftBlockEntityState<>(this); + protected CraftBlockEntityState(CraftBlockEntityState state, Location location) { +@@ -165,4 +176,11 @@ public class CraftBlockEntityState extends CraftBlockStat + public CraftBlockEntityState copy(Location location) { + return new CraftBlockEntityState<>(this, location); } + + // Paper start @@ -114,10 +114,10 @@ index fa490e01d1358762eda7f41db532024fc4c7605a..e7fd9ebd47af277d6dbced0f17e95472 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java -index 8b454bdb8a9a202ece4912320f3ac373e4fff65c..76a3f4ad26718f95f4cf64206efe16e598fa2285 100644 +index 9d22f389dfce7b800e29efab767fac842651490a..4c30af81697db25d9913b436c45d9a926cbb5cca 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockStates.java -@@ -382,15 +382,30 @@ public final class CraftBlockStates { +@@ -387,15 +387,30 @@ public final class CraftBlockStates { } public static BlockState getBlockState(Block block) { @@ -147,7 +147,7 @@ index 8b454bdb8a9a202ece4912320f3ac373e4fff65c..76a3f4ad26718f95f4cf64206efe16e5 + // Paper end } - public static BlockState getBlockState(Material material, @Nullable CompoundTag blockEntityTag) { + @Deprecated diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java index dbb9a5b2f8d3bc0b13e0f56f6e8a0d9a7b761327..3001bb0e3d4af9b16645a0136093db594b89ab01 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java diff --git a/patches/unapplied/server/0172-AsyncTabCompleteEvent.patch b/patches/server/0168-AsyncTabCompleteEvent.patch similarity index 97% rename from patches/unapplied/server/0172-AsyncTabCompleteEvent.patch rename to patches/server/0168-AsyncTabCompleteEvent.patch index d3e5b18005..2551e2840a 100644 --- a/patches/unapplied/server/0172-AsyncTabCompleteEvent.patch +++ b/patches/server/0168-AsyncTabCompleteEvent.patch @@ -16,10 +16,10 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent Co-authored-by: Aikar diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ff113cb3c11492ec09e0568f96fff40cbcd53716..8eec3d8b1693d9f9d7d882275e6f00cef4d3520f 100644 +index 904aab6c4c3434756e25def2acdf5ca7afebb465..56134a163da44b0bb50121831e91e9f93e86417d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -688,21 +688,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -714,21 +714,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } @@ -80,10 +80,10 @@ index ff113cb3c11492ec09e0568f96fff40cbcd53716..8eec3d8b1693d9f9d7d882275e6f00ce this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b6e6b4213e893fac64855cc4b4e6eeb4246050d1..28a8b687958a1c1396a5a8b13a04fb371ac9f3ab 100644 +index f351667cec83f39c28073e262b6c9b51873fb327..bf61a439d81b481c6d27a3b399a3a08e96d3909c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2239,7 +2239,7 @@ public final class CraftServer implements Server { +@@ -2251,7 +2251,7 @@ public final class CraftServer implements Server { offers = this.tabCompleteChat(player, message); } diff --git a/patches/unapplied/server/0173-PlayerPickupExperienceEvent.patch b/patches/server/0169-PlayerPickupExperienceEvent.patch similarity index 88% rename from patches/unapplied/server/0173-PlayerPickupExperienceEvent.patch rename to patches/server/0169-PlayerPickupExperienceEvent.patch index 3b2845e66a..e604445c7b 100644 --- a/patches/unapplied/server/0173-PlayerPickupExperienceEvent.patch +++ b/patches/server/0169-PlayerPickupExperienceEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -index 00b46fd0b4a718756f8b21f203fd5679bc2a79d8..97524656b8af7b80aeb7845575c704585dade725 100644 +index 1a829f79e6f9e03ead745e13ece4d1b57195dbb4..105b07cb8efd6a4304c4cf6650affa46a7852941 100644 --- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java +++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java -@@ -313,7 +313,7 @@ public class ExperienceOrb extends Entity { +@@ -319,7 +319,7 @@ public class ExperienceOrb extends Entity { @Override public void playerTouch(Player player) { if (!this.level().isClientSide) { diff --git a/patches/unapplied/server/0174-Ability-to-apply-mending-to-XP-API.patch b/patches/server/0170-Ability-to-apply-mending-to-XP-API.patch similarity index 94% rename from patches/unapplied/server/0174-Ability-to-apply-mending-to-XP-API.patch rename to patches/server/0170-Ability-to-apply-mending-to-XP-API.patch index 916e87f7c4..2f59046c01 100644 --- a/patches/unapplied/server/0174-Ability-to-apply-mending-to-XP-API.patch +++ b/patches/server/0170-Ability-to-apply-mending-to-XP-API.patch @@ -14,10 +14,10 @@ public net.minecraft.world.entity.ExperienceOrb durabilityToXp(I)I public net.minecraft.world.entity.ExperienceOrb xpToDurability(I)I diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 19ca1d6f6dc01ee56cb52d8d3e2c53c1549cb617..fbb1c342e51d3d64a837efe998a33632ad254b23 100644 +index aa08ba311a28af0806d5432423325723afb9f711..5cb5ec6cdbc71be2c3ef6b87b76b5f6007b65ea2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1548,7 +1548,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1624,7 +1624,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } @Override diff --git a/patches/unapplied/server/0175-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0171-PlayerNaturallySpawnCreaturesEvent.patch similarity index 89% rename from patches/unapplied/server/0175-PlayerNaturallySpawnCreaturesEvent.patch rename to patches/server/0171-PlayerNaturallySpawnCreaturesEvent.patch index b535464839..a022415f3d 100644 --- a/patches/unapplied/server/0175-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0171-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,10 +9,10 @@ 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/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 97bb0fc7e890273f2f975f137ec1194a1a83fde7..2a0e81a3ec0774ad98e2d74ac7672c167e28f38e 100644 +index 15c9f4822d1d11d05de6c2d6797ee3e845b3a1ab..46da628073e2bfb77b3deab623dba46228d92618 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1203,7 +1203,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1221,7 +1221,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider chunkRange = (chunkRange > this.level.spigotConfig.viewDistance) ? (byte) this.level.spigotConfig.viewDistance : chunkRange; chunkRange = (chunkRange > 8) ? 8 : chunkRange; @@ -23,7 +23,7 @@ index 97bb0fc7e890273f2f975f137ec1194a1a83fde7..2a0e81a3ec0774ad98e2d74ac7672c16 // Spigot end if (!this.distanceManager.hasPlayersNearby(chunkcoordintpair.toLong())) { return false; -@@ -1218,6 +1220,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1236,6 +1238,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } entityplayer = (ServerPlayer) iterator.next(); @@ -40,10 +40,10 @@ index 97bb0fc7e890273f2f975f137ec1194a1a83fde7..2a0e81a3ec0774ad98e2d74ac7672c16 return true; diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index e0ae7274da59ff043cd423d282ed8db0382561d4..369e4bf5ff52cb774f1acaf760b8bd276a0745f5 100644 +index 3f60a3289ec58d5eb3c0c5634ca62ef2fa287ce7..bc81649b09c39188697b8851abedafca0dde9d99 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -568,6 +568,15 @@ public class ServerChunkCache extends ChunkSource { +@@ -558,6 +558,15 @@ public class ServerChunkCache extends ChunkSource { boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit Util.shuffle(list, this.level.random); @@ -60,10 +60,10 @@ index e0ae7274da59ff043cd423d282ed8db0382561d4..369e4bf5ff52cb774f1acaf760b8bd27 boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit Iterator iterator1 = list.iterator(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 54f343a1979794781757b221514f70aa0f7a5dec..98d229fb8f342775482f2ed199265bda3f043a96 100644 +index 82498ec7f0de4c1b82c7882824587ed3ba7fd5d6..84e8ab9bdd4911412732e490ff8d10ba93d67f45 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -265,6 +265,7 @@ public class ServerPlayer extends Player { +@@ -281,6 +281,7 @@ public class ServerPlayer extends Player { // CraftBukkit end public boolean isRealPlayer; // Paper public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper diff --git a/patches/unapplied/server/0176-Add-setPlayerProfile-API-for-Skulls.patch b/patches/server/0172-Add-setPlayerProfile-API-for-Skulls.patch similarity index 87% rename from patches/unapplied/server/0176-Add-setPlayerProfile-API-for-Skulls.patch rename to patches/server/0172-Add-setPlayerProfile-API-for-Skulls.patch index 9a88d6ffaf..99435ec31e 100644 --- a/patches/unapplied/server/0176-Add-setPlayerProfile-API-for-Skulls.patch +++ b/patches/server/0172-Add-setPlayerProfile-API-for-Skulls.patch @@ -7,10 +7,10 @@ This allows you to create already filled textures on Skulls to avoid texture loo which commonly cause rate limit issues with Mojang API diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java -index 6c40bb4e06322bcce31561f5cfb9dc53f266f062..ba063a4e52a841a4365efb1cf78415b04b2bcc4c 100644 +index aa965ea05fb364e9cfc4bbf4241a47c3400355b0..45ac1d9193c3a0dc397d6e7ccfccec896fa78a13 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java -@@ -111,7 +111,22 @@ public class CraftSkull extends CraftBlockEntityState implemen +@@ -98,7 +98,22 @@ public class CraftSkull extends CraftBlockEntityState implemen } } @@ -33,7 +33,7 @@ index 6c40bb4e06322bcce31561f5cfb9dc53f266f062..ba063a4e52a841a4365efb1cf78415b0 public PlayerProfile getOwnerProfile() { if (!this.hasOwner()) { return null; -@@ -121,11 +136,12 @@ public class CraftSkull extends CraftBlockEntityState implemen +@@ -108,11 +123,12 @@ public class CraftSkull extends CraftBlockEntityState implemen } @Override @@ -48,10 +48,10 @@ index 6c40bb4e06322bcce31561f5cfb9dc53f266f062..ba063a4e52a841a4365efb1cf78415b0 } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 062594cebbe8cc0a0c94ecf7c8da4ee349a27521..b2bab2d79c969bc81b160312a996fb9cd87d0f95 100644 +index d20ae5345d85dee1bcc83a45837d2288a6da49be..0f725408691384800abb2cc7a43d9e1c75c9a17e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -187,6 +187,19 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { +@@ -178,6 +178,19 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { return this.hasOwner() ? this.profile.getName() : null; } @@ -71,7 +71,7 @@ index 062594cebbe8cc0a0c94ecf7c8da4ee349a27521..b2bab2d79c969bc81b160312a996fb9c @Override public OfflinePlayer getOwningPlayer() { if (this.hasOwner()) { -@@ -237,6 +250,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { +@@ -228,6 +241,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { } @Override @@ -79,7 +79,7 @@ index 062594cebbe8cc0a0c94ecf7c8da4ee349a27521..b2bab2d79c969bc81b160312a996fb9c public PlayerProfile getOwnerProfile() { if (!this.hasOwner()) { return null; -@@ -246,11 +260,12 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { +@@ -237,11 +251,12 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { } @Override @@ -93,7 +93,7 @@ index 062594cebbe8cc0a0c94ecf7c8da4ee349a27521..b2bab2d79c969bc81b160312a996fb9c } } -@@ -305,7 +320,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { +@@ -295,7 +310,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { Builder serialize(Builder builder) { super.serialize(builder); if (this.profile != null) { diff --git a/patches/unapplied/server/0066-Player-Tab-List-and-Title-APIs.patch b/patches/unapplied/server/0066-Player-Tab-List-and-Title-APIs.patch deleted file mode 100644 index 0bfac6bd37..0000000000 --- a/patches/unapplied/server/0066-Player-Tab-List-and-Title-APIs.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Techcable -Date: Thu, 3 Mar 2016 02:32:10 -0600 -Subject: [PATCH] Player Tab List and Title APIs - - -diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index 53f033d2d887909f5f905c00122d1b09809e5e3c..b9dd91927cb259789ad71b2241024c5fa2586d57 100644 ---- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java -+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -545,6 +545,12 @@ public class FriendlyByteBuf extends ByteBuf { - return this.writeWithCodec(NbtOps.INSTANCE, ComponentSerialization.localizedCodec(this.adventure$locale), text); - // Paper end - adventure; support writing adventure components directly and server-side translations - } -+ // Paper start - deprecated Tab List & Title APIs -+ @Deprecated -+ public FriendlyByteBuf writeComponent(final net.md_5.bungee.api.chat.BaseComponent[] component) { -+ return this.writeComponent(java.util.Objects.requireNonNull(Component.Serializer.fromJson(net.md_5.bungee.chat.ComponentSerializer.toString(component)))); -+ } -+ // Paper end - deprecated Tab List & Title APIs - - public > T readEnum(Class enumClass) { - return ((T[]) enumClass.getEnumConstants())[this.readVarInt()]; // CraftBukkit - fix decompile error -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java -index e77bd5bb66279f579fad4fdcc8b0606410922e9e..4c05fee93eb20044a4198c43d5ae1eebebaabaf7 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetSubtitleTextPacket.java -@@ -7,6 +7,7 @@ import net.minecraft.network.protocol.Packet; - public class ClientboundSetSubtitleTextPacket implements Packet { - private final Component text; - public net.kyori.adventure.text.Component adventure$text; // Paper -+ public net.md_5.bungee.api.chat.BaseComponent[] components; // Paper - - public ClientboundSetSubtitleTextPacket(Component subtitle) { - this.text = subtitle; -@@ -21,6 +22,8 @@ public class ClientboundSetSubtitleTextPacket implements Packet { - private final Component text; - public net.kyori.adventure.text.Component adventure$text; // Paper -+ public net.md_5.bungee.api.chat.BaseComponent[] components; // Paper - - public ClientboundSetTitleTextPacket(Component title) { - this.text = title; -@@ -21,6 +22,8 @@ public class ClientboundSetTitleTextPacket implements Packet -Date: Thu, 31 Mar 2016 19:17:58 -0400 -Subject: [PATCH] Do not load chunks for Pathfinding - - -diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -index 13840b12e209b62783206861b817d433eedd6191..b125b9903454891e22a15a0a794d67be67fdb083 100644 ---- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -469,7 +469,12 @@ public class WalkNodeEvaluator extends NodeEvaluator { - for (int n = -1; n <= 1; n++) { - if (l != 0 || n != 0) { - pos.set(i + l, j + m, k + n); -- BlockState blockState = world.getBlockState(pos); -+ // Paper start - Do not load chunks during pathfinding -+ BlockState blockState = world.getBlockStateIfLoaded(pos); -+ if (blockState == null) { -+ return BlockPathTypes.BLOCKED; -+ } else { -+ // Paper end - Do not load chunks during pathfinding - if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH)) { - return BlockPathTypes.DANGER_OTHER; - } -@@ -485,6 +490,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { - if (blockState.is(Blocks.WITHER_ROSE) || blockState.is(Blocks.POINTED_DRIPSTONE)) { - return BlockPathTypes.DAMAGE_CAUTIOUS; - } -+ } // Paper - } - } - } -@@ -494,7 +500,8 @@ public class WalkNodeEvaluator extends NodeEvaluator { - } - - protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) { -- BlockState blockState = world.getBlockState(pos); -+ BlockState blockState = world.getBlockStateIfLoaded(pos); // Paper - Do not load chunks during pathfinding -+ if (blockState == null) return BlockPathTypes.BLOCKED; // Paper - Do not load chunks during pathfinding - Block block = blockState.getBlock(); - if (blockState.isAir()) { - return BlockPathTypes.OPEN; diff --git a/patches/unapplied/server/0097-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/patches/unapplied/server/0097-Add-handshake-event-to-allow-plugins-to-handle-clien.patch deleted file mode 100644 index b368b4d286..0000000000 --- a/patches/unapplied/server/0097-Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kashike -Date: Wed, 13 Apr 2016 20:21:38 -0700 -Subject: [PATCH] Add handshake event to allow plugins to handle client - handshaking logic themselves - - -diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -index 5dedfeaa6cc683b5fc6c21f842265b8aea64fa58..ce51bde4db395ff30c7d75e3badd68d6395fa40f 100644 ---- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java -@@ -89,9 +89,44 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - this.connection.disconnect(ichatmutablecomponent); - } else { - this.connection.setListener(new ServerLoginPacketListenerImpl(this.server, this.connection)); -+ // Paper start - PlayerHandshakeEvent -+ boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee; -+ boolean handledByEvent = false; -+ // Try and handle the handshake through the event -+ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me? -+ java.net.SocketAddress socketAddress = this.connection.address; -+ String hostnameOfRemote = socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getHostString() : InetAddress.getLoopbackAddress().getHostAddress(); -+ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packet.hostName(), hostnameOfRemote, !proxyLogicEnabled); -+ if (event.callEvent()) { -+ // If we've failed somehow, let the client know so and go no further. -+ if (event.isFailed()) { -+ Component component = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.failMessage()); -+ this.connection.send(new ClientboundLoginDisconnectPacket(component)); -+ this.connection.disconnect(component); -+ return; -+ } -+ -+ if (event.getServerHostname() != null) { -+ // change hostname -+ packet = new ClientIntentionPacket( -+ packet.protocolVersion(), -+ event.getServerHostname(), -+ packet.port(), -+ packet.intention() -+ ); -+ } -+ if (event.getSocketAddressHostname() != null) this.connection.address = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); -+ this.connection.spoofedUUID = event.getUniqueId(); -+ this.connection.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); -+ handledByEvent = true; // Hooray, we did it! -+ } -+ } - // Spigot Start - String[] split = packet.hostName().split("\00"); -- if (org.spigotmc.SpigotConfig.bungee) { -+ // Don't try and handle default logic if it's been handled by the event. -+ if (!handledByEvent && proxyLogicEnabled) { -+ // Paper end - PlayerHandshakeEvent -+ // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { - this.connection.hostname = split[0]; - this.connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); diff --git a/patches/unapplied/server/0127-String-based-Action-Bar-API.patch b/patches/unapplied/server/0127-String-based-Action-Bar-API.patch deleted file mode 100644 index 7a1dc79fbe..0000000000 --- a/patches/unapplied/server/0127-String-based-Action-Bar-API.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 27 Dec 2016 15:02:42 -0500 -Subject: [PATCH] String based Action Bar API - - -diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java -index cb88a3a4e4c87a6d6c838183c1640b13d82c9344..0b391b0dc6262ef482c4a253a074b593127cc1d4 100644 ---- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java -+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetActionBarTextPacket.java -@@ -7,6 +7,7 @@ import net.minecraft.network.protocol.Packet; - public class ClientboundSetActionBarTextPacket implements Packet { - private final Component text; - public net.kyori.adventure.text.Component adventure$text; // Paper -+ public net.md_5.bungee.api.chat.BaseComponent[] components; // Paper - - public ClientboundSetActionBarTextPacket(Component message) { - this.text = message; -@@ -21,6 +22,8 @@ public class ClientboundSetActionBarTextPacket implements Packet -Date: Wed, 4 May 2016 22:43:12 -0400 -Subject: [PATCH] ensureServerConversions API - -This will take a Bukkit ItemStack and run it through any conversions a server process would perform on it, -to ensure it meets latest minecraft expectations. - -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 70511628eefc28163d07f50f18d9cc55dd93d68b..9d34a7cd8361fd65d30537d4498c8e2a03d93bb1 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -230,7 +230,7 @@ public final class ItemStack { - - // Called to run this stack through the data converter to handle older storage methods and serialized items - public void convertStack(int version) { -- if (0 < version && version < CraftMagicNumbers.INSTANCE.getDataVersion()) { -+ if (0 < version && version < CraftMagicNumbers.INSTANCE.getDataVersion() && MinecraftServer.getServer() != null) { // Paper - skip conversion if the server doesn't exist (for tests) - CompoundTag savedStack = new CompoundTag(); - this.save(savedStack); - savedStack = (CompoundTag) MinecraftServer.getServer().fixerUpper.update(References.ITEM_STACK, new Dynamic(NbtOps.INSTANCE, savedStack), version, CraftMagicNumbers.INSTANCE.getDataVersion()).getValue(); -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 0875dfe89644f5f54d004488ed980092b31c6416..89bc6cb62123bc17d579b578c4d1d2e5f8c40837 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -505,4 +505,11 @@ public final class CraftItemFactory implements ItemFactory { - return io.papermc.paper.adventure.PaperAdventure.asAdventure(CraftItemStack.asNMSCopy(itemStack).getDisplayName()); - } - // Paper end - Adventure -+ -+ // Paper start - ensure server conversions API -+ @Override -+ public ItemStack ensureServerConversions(ItemStack item) { -+ return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); -+ } -+ // Paper end - ensure server conversions API - } diff --git a/patches/unapplied/server/0166-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/patches/unapplied/server/0166-Send-attack-SoundEffects-only-to-players-who-can-see.patch deleted file mode 100644 index ad10a37d50..0000000000 --- a/patches/unapplied/server/0166-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brokkonaut -Date: Tue, 31 Oct 2017 03:26:18 +0100 -Subject: [PATCH] Send attack SoundEffects only to players who can see the - attacker - - -diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 4bbf8bb418e3585be2efce5d9a8785faafe7cdde..0043a1f877a0a74d361a37dfa0652d1931835988 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Player.java -+++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -1227,7 +1227,7 @@ public abstract class Player extends LivingEntity { - int i = b0 + EnchantmentHelper.getKnockbackBonus(this); - - if (this.isSprinting() && flag) { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - ++i; - flag1 = true; - } -@@ -1302,7 +1302,7 @@ public abstract class Player extends LivingEntity { - } - } - -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_SWEEP, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - this.sweepAttack(); - } - -@@ -1330,15 +1330,15 @@ public abstract class Player extends LivingEntity { - } - - if (flag2) { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_CRIT, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - this.crit(target); - } - - if (!flag2 && !flag3) { - if (flag) { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_STRONG, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - } else { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_WEAK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - } - } - -@@ -1390,7 +1390,7 @@ public abstract class Player extends LivingEntity { - - this.causeFoodExhaustion(this.level().spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value - } else { -- this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); -+ sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility - if (flag4) { - target.clearFire(); - } -@@ -1791,6 +1791,14 @@ public abstract class Player extends LivingEntity { - public int getXpNeededForNextLevel() { - return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); - } -+ // Paper start - send while respecting visibility -+ private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { -+ fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself -+ if (fromEntity instanceof ServerPlayer) { -+ ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong())); -+ } -+ } -+ // Paper end - send while respecting visibility - - // CraftBukkit start - public void causeFoodExhaustion(float exhaustion) { diff --git a/work/Bukkit b/work/Bukkit index 664548f4ec..9ea9bb32fe 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 664548f4eca483e1b9722c5252e322205ba6e201 +Subproject commit 9ea9bb32fe341b8308f6071bcc5f31c1e73a9d26 diff --git a/work/CraftBukkit b/work/CraftBukkit index 8d3e67d865..062d2bb13b 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 8d3e67d8653ffb29b0fd00adaffd3f166aa10e7d +Subproject commit 062d2bb13b341b2bcc9a504677b2196c6f68ecb3