From 7c42959fb07f36266ecb1dfecc00507ebe1f3e6d Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 26 Dec 2022 09:53:35 -0800 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) (#8714) 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: aef9b6d2 PR-800: Add support for NoteBlock sounds in Skulls CraftBukkit Changes: ae8f5fc02 PR-1125: Add support for NoteBlock sounds in Skulls 0a1c89e4b SPIGOT-7212: Allow negative firework power 909a246af SPIGOT-7211: generateTree() with Consumer or Predicate is broken c810c3ed8 Increase outdated build delay --- .../Add-setPlayerProfile-API-for-Skulls.patch | 2 +- .../api/Mark-experimental-api-as-such.patch | 40 ++++++ patches/api/fix-Instruments.patch | 125 ++++++++++++------ ...rtant-BlockStateListPopulator-method.patch | 19 ++- .../Add-setPlayerProfile-API-for-Skulls.patch | 4 +- patches/server/Build-system-changes.patch | 2 +- ...-profile-lookups-to-worldgen-threads.patch | 10 +- patches/server/Fix-this-stupid-bullshit.patch | 2 +- ...ient-crashes-server-lists-and-Mojang.patch | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 11 files changed, 150 insertions(+), 60 deletions(-) diff --git a/patches/api/Add-setPlayerProfile-API-for-Skulls.patch b/patches/api/Add-setPlayerProfile-API-for-Skulls.patch index 715a1cfb32..7a34159024 100644 --- a/patches/api/Add-setPlayerProfile-API-for-Skulls.patch +++ b/patches/api/Add-setPlayerProfile-API-for-Skulls.patch @@ -87,4 +87,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Deprecated // Paper void setOwnerProfile(@Nullable PlayerProfile profile); - @Override + /** diff --git a/patches/api/Mark-experimental-api-as-such.patch b/patches/api/Mark-experimental-api-as-such.patch index a7b1941b50..95ef207798 100644 --- a/patches/api/Mark-experimental-api-as-such.patch +++ b/patches/api/Mark-experimental-api-as-such.patch @@ -348,6 +348,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +@org.jetbrains.annotations.ApiStatus.Experimental // Paper public interface HangingSign extends Sign { } +diff --git a/src/main/java/org/bukkit/block/Skull.java b/src/main/java/org/bukkit/block/Skull.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/block/Skull.java ++++ b/src/main/java/org/bukkit/block/Skull.java +@@ -0,0 +0,0 @@ public interface Skull extends TileState { + * + * @return the key of the sound, or null + */ ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper + @Nullable + public NamespacedKey getNoteBlockSound(); + +@@ -0,0 +0,0 @@ public interface Skull extends TileState { + * + * @param noteBlockSound the key of the sound to be played, or null + */ ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper + public void setNoteBlockSound(@Nullable NamespacedKey noteBlockSound); + + /** diff --git a/src/main/java/org/bukkit/block/data/type/ChiseledBookshelf.java b/src/main/java/org/bukkit/block/data/type/ChiseledBookshelf.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/data/type/ChiseledBookshelf.java @@ -454,3 +474,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public interface BundleMeta extends ItemMeta { /** +diff --git a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/meta/SkullMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/SkullMeta.java +@@ -0,0 +0,0 @@ public interface SkullMeta extends ItemMeta { + * + * @param noteBlockSound the key of the sound to be played, or null + */ ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper + void setNoteBlockSound(@Nullable NamespacedKey noteBlockSound); + + /** +@@ -0,0 +0,0 @@ public interface SkullMeta extends ItemMeta { + * + * @return the key of the sound, or null + */ ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper + @Nullable + NamespacedKey getNoteBlockSound(); + diff --git a/patches/api/fix-Instruments.patch b/patches/api/fix-Instruments.patch index 0d0a11716b..9e9c49e6b9 100644 --- a/patches/api/fix-Instruments.patch +++ b/patches/api/fix-Instruments.patch @@ -30,50 +30,80 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 STICKS(0x3), @@ -0,0 +0,0 @@ public enum Instrument { /** - * Pling is normally played when a note block is on top of a glowstone block. + * Zombie is normally played when a Zombie Head is on top of the note block. */ -- PLING(0xF); -+ // Paper start -+ PLING(0xF), -+ /** -+ * Zombie is normally played when a zombie head is on top of a note block. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ ZOMBIE(0x10), -+ /** -+ * Skeleton is normally played when a skeleton skull is on top of a note block. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ SKELETON(0x11), -+ /** -+ * Creeper is normally played when a creeper head is on top of a note block. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ CREEPER(0x12), -+ /** -+ * Dragon is normally played when an Ender Dragon head is on top of a note block. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ DRAGON(0x13), -+ /** -+ * Wither skeleton is normally played when a wither skeleton skull head is on top of a note block. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ WITHER_SKELETON(0x14), -+ /** -+ * Piglin is normally played when a piglin head is on top of a note block. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ PIGLIN(0x15), -+ /** -+ * Custom head is normally played when a player head is on top of a note block. -+ */ -+ @org.jetbrains.annotations.ApiStatus.Experimental -+ CUSTOM_HEAD(0x16); -+ // Paper end +- ZOMBIE, ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper ++ ZOMBIE(0x10), // Paper + /** + * Skeleton is normally played when a Skeleton Head is on top of the note block. + */ +- SKELETON, ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper ++ SKELETON(0x11), // Paper + /** + * Creeper is normally played when a Creeper Head is on top of the note block. + */ +- CREEPER, ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper ++ CREEPER(0x12), // Paper + /** + * Dragon is normally played when a Dragon Head is on top of the note block. + */ +- DRAGON, ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper ++ DRAGON(0x13), // Paper + /** + * Wither Skeleton is normally played when a Wither Skeleton Head is on top of the note block. + */ +- WITHER_SKELETON, ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper ++ WITHER_SKELETON(0x14), // Paper + /** + * Piglin is normally played when a Piglin Head is on top of the note block. + */ +- PIGLIN, ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper ++ PIGLIN(0x15), // Paper + /** + * Custom Sound is normally played when a Player Head with the required data is on top of the note block. + */ +- CUSTOM_HEAD; ++ @org.jetbrains.annotations.ApiStatus.Experimental // Paper ++ CUSTOM_HEAD(0x16); // Paper private final byte type; private static final Map BY_DATA = Maps.newHashMap(); + +- private Instrument() { +- this(-1); +- } ++ // Paper - remove ctor (the server still uses the byte magic value) + + private Instrument(final int type) { + this.type = (byte) type; +@@ -0,0 +0,0 @@ public enum Instrument { + + /** + * @return The type ID of this instrument. +- * @deprecated Magic value + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + public byte getType() { + return this.type; + } +@@ -0,0 +0,0 @@ public enum Instrument { + * + * @param type The type ID + * @return The instrument +- * @deprecated Magic value + */ +- @Deprecated ++ @org.jetbrains.annotations.ApiStatus.Internal // Paper + @Nullable + public static Instrument getByType(final byte type) { + return BY_DATA.get(type); diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Player.java @@ -89,3 +119,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * * @param loc The location of a note block * @param instrument The instrument +diff --git a/src/test/java/org/bukkit/InstrumentTest.java b/src/test/java/org/bukkit/InstrumentTest.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/test/java/org/bukkit/InstrumentTest.java ++++ b/src/test/java/org/bukkit/InstrumentTest.java +@@ -0,0 +0,0 @@ public class InstrumentTest { + @Test + public void getByType() { + for (Instrument instrument : Instrument.values()) { +- if (instrument.getType() < 0) { +- continue; +- } ++ // Paper - byte magic values are still used + + assertThat(Instrument.getByType(instrument.getType()), is(instrument)); + } diff --git a/patches/server/Add-missing-important-BlockStateListPopulator-method.patch b/patches/server/Add-missing-important-BlockStateListPopulator-method.patch index 4ac7ee6c88..6511d06251 100644 --- a/patches/server/Add-missing-important-BlockStateListPopulator-method.patch +++ b/patches/server/Add-missing-important-BlockStateListPopulator-method.patch @@ -10,15 +10,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java +++ b/src/main/java/org/bukkit/craftbukkit/util/BlockStateListPopulator.java @@ -0,0 +0,0 @@ public class BlockStateListPopulator extends DummyGeneratorAccess { - public DimensionType dimensionType() { - return this.world.dimensionType(); + + @Override + public boolean isFluidAtPosition(BlockPos pos, Predicate state) { +- return this.world.isFluidAtPosition(pos, state); ++ return state.test(this.getFluidState(pos)); // Paper - fix + } + + @Override +@@ -0,0 +0,0 @@ public class BlockStateListPopulator extends DummyGeneratorAccess { + public RegistryAccess registryAccess() { + return this.world.registryAccess(); } -+ // Paper start -+ @Override -+ public boolean isFluidAtPosition(BlockPos pos, Predicate state) { -+ return state.test(this.getFluidState(pos)); -+ } + ++ // Paper start + @Override + public java.util.Optional getBlockEntity(BlockPos pos, net.minecraft.world.level.block.entity.BlockEntityType type) { + BlockEntity tileentity = this.getBlockEntity(pos); diff --git a/patches/server/Add-setPlayerProfile-API-for-Skulls.patch b/patches/server/Add-setPlayerProfile-API-for-Skulls.patch index 99ea9f931e..e14772a6a3 100644 --- a/patches/server/Add-setPlayerProfile-API-for-Skulls.patch +++ b/patches/server/Add-setPlayerProfile-API-for-Skulls.patch @@ -100,5 +100,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - return builder.put(SKULL_OWNER.BUKKIT, new CraftPlayerProfile(this.profile)); + return builder.put(SKULL_OWNER.BUKKIT, new com.destroystokyo.paper.profile.CraftPlayerProfile(this.profile)); // Paper } - return builder; - } + NamespacedKey namespacedKeyNB = this.getNoteBlockSound(); + if (namespacedKeyNB != null) { diff --git a/patches/server/Build-system-changes.patch b/patches/server/Build-system-changes.patch index b9f05ddb56..4065482b16 100644 --- a/patches/server/Build-system-changes.patch +++ b/patches/server/Build-system-changes.patch @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Date buildDate = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(Main.class.getPackage().getImplementationVendor()); // Paper Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -7); + deadline.add(Calendar.DAY_OF_YEAR, -14); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch index 7eb4e490cf..9d417dd588 100644 --- a/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -55,13 +55,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java @@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity { public static void updateGameprofile(@Nullable GameProfile owner, Consumer callback) { - if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && profileCache != null && sessionService != null) { - profileCache.getAsync(owner.getName(), (profile) -> { + if (owner != null && !StringUtil.isNullOrEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && SkullBlockEntity.profileCache != null && SkullBlockEntity.sessionService != null) { + SkullBlockEntity.profileCache.getAsync(owner.getName(), (optional) -> { - Util.backgroundExecutor().execute(() -> { + Util.PROFILE_EXECUTOR.execute(() -> { // Paper - not a good idea to use BLOCKING OPERATIONS on the worldgen executor - Util.ifElse(profile, (profilex) -> { - Property property = Iterables.getFirst(profilex.getProperties().get("textures"), (Property)null); - if (property == null) { + Util.ifElse(optional, (gameprofile1) -> { + Property property = (Property) Iterables.getFirst(gameprofile1.getProperties().get("textures"), (Object) null); + diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java diff --git a/patches/server/Fix-this-stupid-bullshit.patch b/patches/server/Fix-this-stupid-bullshit.patch index b0622a8f53..e16409d4a9 100644 --- a/patches/server/Fix-this-stupid-bullshit.patch +++ b/patches/server/Fix-this-stupid-bullshit.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -7); + deadline.add(Calendar.DAY_OF_YEAR, -14); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 4f4f1a2f1e..841458cff4 100644 --- a/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/patches/server/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { - deadline.add(Calendar.DAY_OF_YEAR, -7); + deadline.add(Calendar.DAY_OF_YEAR, -14); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); diff --git a/work/Bukkit b/work/Bukkit index f50ad1f8b3..aef9b6d205 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit f50ad1f8b307cda71968d3f53921ab29d1e5835a +Subproject commit aef9b6d2051e45d924d2e2b294fdb700b357bd3c diff --git a/work/CraftBukkit b/work/CraftBukkit index 2ed3e3e6e5..ae8f5fc025 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 2ed3e3e6e50cb606709522d4476f98e9edc5e79c +Subproject commit ae8f5fc02595a9a70dab28ad1835c9cd44ddc60d