From 7bd24cf0a9b55143cd190986c468b64ec6b31192 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 6 Dec 2023 22:59:39 +0100 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) 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 Bukkit Changes: 9a294519 SPIGOT-7533, 943: Add missing Poses for 1.20.3 be2884c4 Add unique ID to PlayerResourcePackStatusEvent d9c1eb83 Add additional @MinecraftExperimental annotations 68f5bb6a SPIGOT-7526: Add missing PlayerResourcePackStatusEvent statuses CraftBukkit Changes: 368c48be1 Fix formatting issue in previous commit da8f91f31 SPIGOT-7534: Error when chunk with decorated pot trying to save d20c9291a SPIGOT-7532: Entity#isValid() returns false after server restart ec1fa2ead PR-1309: Add tests for Bukkit Pose 5a7080b58 Add unique ID to PlayerResourcePackStatusEvent 0fd734950 SPIGOT-7528: Fix certain custom shaped recipes --- patches/api/Complete-resource-pack-API.patch | 14 +++-- .../server/Complete-resource-pack-API.patch | 4 +- patches/server/Entity-Origin-API.patch | 2 +- ...x-decorated-pots-crashing-the-server.patch | 57 ------------------- ...-PlayerChunkMap-adds-crashing-server.patch | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 7 files changed, 14 insertions(+), 69 deletions(-) delete mode 100644 patches/server/Fix-decorated-pots-crashing-the-server.patch diff --git a/patches/api/Complete-resource-pack-API.patch b/patches/api/Complete-resource-pack-API.patch index c84cae58e8..ae0faf2e0b 100644 --- a/patches/api/Complete-resource-pack-API.patch +++ b/patches/api/Complete-resource-pack-API.patch @@ -147,36 +147,38 @@ diff --git a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerResourcePackStatusEvent.java -@@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; - public class PlayerResourcePackStatusEvent extends PlayerEvent { +@@ -0,0 +0,0 @@ public class PlayerResourcePackStatusEvent extends PlayerEvent { private static final HandlerList handlers = new HandlerList(); + private final UUID id; + @Deprecated + private final String hash; // Paper private final Status status; - public PlayerResourcePackStatusEvent(@NotNull final Player who, @NotNull Status resourcePackStatus) { + public PlayerResourcePackStatusEvent(@NotNull final Player who, @NotNull UUID id, @NotNull Status resourcePackStatus) { super(who); + this.id = id; + this.hash = null; // Paper this.status = resourcePackStatus; } + @Deprecated // Paper -+ public PlayerResourcePackStatusEvent(final Player who, Status resourcePackStatus, String hash) { ++ public PlayerResourcePackStatusEvent(@NotNull final Player who, @NotNull UUID id, Status resourcePackStatus, String hash) { + super(who); ++ this.id = id; + this.hash = hash; // Paper + this.status = resourcePackStatus; + } + -+ @Deprecated + /** + * @deprecated Hash does not seem to ever be set + */ ++ @Deprecated + public String getHash() { + return this.hash; + } + // Paper end + /** - * Gets the status of this pack. + * Gets the unique ID of this pack. * diff --git a/patches/server/Complete-resource-pack-API.patch b/patches/server/Complete-resource-pack-API.patch index c49351501c..98a2576f6b 100644 --- a/patches/server/Complete-resource-pack-API.patch +++ b/patches/server/Complete-resource-pack-API.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id()); this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect")); } -- this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()])); // CraftBukkit +- this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()])); // CraftBukkit + // Paper start + PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()]; + player.getBukkitEntity().setResourcePackStatus(packStatus); -+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packStatus)); // CraftBukkit ++ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), packStatus)); // CraftBukkit + // Paper end } diff --git a/patches/server/Entity-Origin-API.patch b/patches/server/Entity-Origin-API.patch index 48ee4eac26..c059b349e7 100644 --- a/patches/server/Entity-Origin-API.patch +++ b/patches/server/Entity-Origin-API.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - entity.updateDynamicGameEventListener(DynamicGameEventListener::add); + entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit + // Paper start - Set origin location when the entity is being added to the world + if (entity.getOriginVector() == null) { diff --git a/patches/server/Fix-decorated-pots-crashing-the-server.patch b/patches/server/Fix-decorated-pots-crashing-the-server.patch deleted file mode 100644 index 0c0b9b80f1..0000000000 --- a/patches/server/Fix-decorated-pots-crashing-the-server.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke -Date: Wed, 6 Dec 2023 22:00:10 +0100 -Subject: [PATCH] Fix decorated pots crashing the server - - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java -@@ -0,0 +0,0 @@ public class DecoratedPotBlockEntity extends BlockEntity implements Randomizable - @Nullable - protected ResourceLocation lootTable; - protected long lootTableSeed; -+ // Paper start - fix cb dumb -+ public java.util.List transaction = new java.util.ArrayList<>(); -+ private int maxStack = MAX_STACK; -+ -+ @Override -+ public int getMaxStackSize() { -+ return this.maxStack; -+ } -+ -+ @Override -+ public java.util.List getContents() { -+ return java.util.Arrays.asList(this.item); -+ } -+ -+ @Override -+ public void onOpen(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.add(who); -+ } -+ -+ @Override -+ public void onClose(org.bukkit.craftbukkit.entity.CraftHumanEntity who) { -+ this.transaction.remove(who); -+ } -+ -+ @Override -+ public java.util.List getViewers() { -+ return this.transaction; -+ } -+ -+ @Override -+ public void setMaxStackSize(int size) { -+ this.maxStack = size; -+ } -+ -+ @Override -+ public org.bukkit.Location getLocation() { -+ if (this.level == null) return null; -+ return new org.bukkit.Location(this.level.getWorld(), this.worldPosition.getX(), this.worldPosition.getY(), this.worldPosition.getZ()); -+ } -+ // Paper end - fix cb dumb - - public DecoratedPotBlockEntity(BlockPos pos, BlockState state) { - super(BlockEntityType.DECORATED_POT, pos, state); diff --git a/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index ba262eec98..23272bbc9f 100644 --- a/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ServerPlayer entityplayer = (ServerPlayer) entity; @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - entity.updateDynamicGameEventListener(DynamicGameEventListener::add); + entity.inWorld = true; // CraftBukkit - Mark entity as in world entity.valid = true; // CraftBukkit + ServerLevel.this.getChunkSource().addEntity(entity); // Paper start - Set origin location when the entity is being added to the world diff --git a/work/Bukkit b/work/Bukkit index adcf6347c5..9a294519b0 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit adcf6347c520b143677b2380edfb228661facf0e +Subproject commit 9a294519b082385a41711eed78797c6b7f3c2476 diff --git a/work/CraftBukkit b/work/CraftBukkit index 8232a74cf8..368c48be1b 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 8232a74cf8d32bce37c33ff6d0cd9b688a1ef8e9 +Subproject commit 368c48be1b32ddc3c062f46b96e4450ea66be935