From 4c6f66a6a315eff96d4eb264e735375b56e89b4c Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sun, 14 Aug 2022 10:03:13 +0200 Subject: [PATCH] Updated Upstream (CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing CraftBukkit Changes: ead719a65 SPIGOT-7136: Cancelling PlayerInteractEntityEvent with the Allay desyncs 8468e167e SPIGOT-7137: StructureGrowEvent isFromBonemeal and getPlayer have incorrect values d45057c59 SPIGOT-7089: Crash when command blocks attempt to load worlds Spigot Changes: 450dcaa8 Rebuild patches --- patches/server/Adventure.patch | 2 +- .../Hide-unnecessary-itemmeta-from-clients.patch | 15 +++++++++++++++ ...handle-async-calls-to-restart-the-server.patch | 2 +- ...-into-worldlist-before-initing-the-world.patch | 8 ++++---- ...ption-on-world-create-while-being-ticked.patch | 2 +- ...-entity-Metadata-for-all-tracked-players.patch | 12 ++++++------ work/CraftBukkit | 2 +- work/Spigot | 2 +- 8 files changed, 30 insertions(+), 15 deletions(-) diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index e0e271e42c..e02ea5d09e 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2057,9 +2057,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start +import io.papermc.paper.adventure.ChatProcessor; // Paper +import io.papermc.paper.adventure.PaperAdventure; // Paper + import java.util.Arrays; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; - import net.minecraft.network.chat.OutgoingPlayerChatMessage; @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic return this.server.isSingleplayerOwner(this.player.getGameProfile()); } diff --git a/patches/server/Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/Hide-unnecessary-itemmeta-from-clients.patch index e9f2605648..fbccb53b43 100644 --- a/patches/server/Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/Hide-unnecessary-itemmeta-from-clients.patch @@ -17,6 +17,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end } } +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + } + // Paper end + // SPIGOT-7136 - Allays +- if (entity instanceof Allay) { +- ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList()))); ++ if (entity instanceof Allay allay) { // Paper ++ ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, allay.stripMeta(allay.getItemBySlot(slot), true))).collect(Collectors.toList()))); // Paper - remove unnecessary item meta + player.containerMenu.sendAllDataToRemote(); + } + } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/patches/server/Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/Properly-handle-async-calls-to-restart-the-server.patch index 7d288af0fb..0837ad3b7b 100644 --- a/patches/server/Properly-handle-async-calls-to-restart-the-server.patch +++ b/patches/server/Properly-handle-async-calls-to-restart-the-server.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> levels; + private Map, ServerLevel> levels; private PlayerList playerList; private volatile boolean running; + private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart diff --git a/patches/server/Put-world-into-worldlist-before-initing-the-world.patch b/patches/server/Put-world-into-worldlist-before-initing-the-world.patch index fe213c0c90..202c2210b4 100644 --- a/patches/server/Put-world-into-worldlist-before-initing-the-world.patch +++ b/patches/server/Put-world-into-worldlist-before-initing-the-world.patch @@ -14,10 +14,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified()); -+ this.levels.put(world.dimension(), world); // Paper - move up ++ this.addLevel(world); // Paper - move up this.initWorld(world, worlddata, worldData, worlddata.worldGenSettings()); -- this.levels.put(world.dimension(), world); +- this.addLevel(world); + // Paper - move up this.getPlayerList().addWorldborderListener(world); @@ -30,11 +30,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return null; } -+ console.levels.put(internal.dimension(), internal); // Paper - move up ++ this.console.addLevel(internal); // Paper - move up this.console.initWorld(internal, worlddata, worlddata, worlddata.worldGenSettings()); internal.setSpawnSettings(true, true); -- console.levels.put(internal.dimension(), internal); +- this.console.addLevel(internal); + // Paper - move up this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal); diff --git a/patches/server/Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/Throw-exception-on-world-create-while-being-ticked.patch index 1a58a48530..72b4562750 100644 --- a/patches/server/Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/Throw-exception-on-world-create-while-being-ticked.patch @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public final class CraftServer implements Server { @Override public World createWorld(WorldCreator creator) { - Preconditions.checkState(!console.levels.isEmpty(), "Cannot create additional worlds on STARTUP"); + Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP"); + Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper Validate.notNull(creator, "Creator may not be null"); diff --git a/patches/server/Update-entity-Metadata-for-all-tracked-players.patch b/patches/server/Update-entity-Metadata-for-all-tracked-players.patch index 33e95e39f9..deb7265929 100644 --- a/patches/server/Update-entity-Metadata-for-all-tracked-players.patch +++ b/patches/server/Update-entity-Metadata-for-all-tracked-players.patch @@ -31,13 +31,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Refresh the current entity metadata - ServerGamePacketListenerImpl.this.send(new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData(), true)); + // Paper start - update entity for all players -+ ClientboundSetEntityDataPacket packet1 = new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData(), true); ++ ClientboundSetEntityDataPacket entityDataPacket = new ClientboundSetEntityDataPacket(entity.getId(), entity.getEntityData(), true); + if (entity.tracker != null) { -+ entity.tracker.broadcast(packet1); ++ entity.tracker.broadcast(entityDataPacket); + } else { -+ ServerGamePacketListenerImpl.this.send(packet1); ++ ServerGamePacketListenerImpl.this.send(entityDataPacket); + } + // Paper end - } - - if (event.isCancelled()) { + // SPIGOT-7136 - Allays + if (entity instanceof Allay) { + ServerGamePacketListenerImpl.this.send(new ClientboundSetEquipmentPacket(entity.getId(), Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values()).map((slot) -> Pair.of(slot, ((LivingEntity) entity).getItemBySlot(slot).copy())).collect(Collectors.toList()))); diff --git a/work/CraftBukkit b/work/CraftBukkit index c379a6b4e4..ead719a65b 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit c379a6b4e421561edd6e1a62e2e4410f48bf1ab1 +Subproject commit ead719a65bf1202e32a4d81442a8bde1a62c07fd diff --git a/work/Spigot b/work/Spigot index 584b459dce..450dcaa86e 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 584b459dceac6e6f4708b70706671206d7a2c8ea +Subproject commit 450dcaa86efd759674bbdeae0f6a37c97977618e