From 0d34a95f8f818dc9490de166376aab7d7a2ccdc9 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sat, 11 Sep 2021 19:27:48 +0200 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) (#6589) 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: 44cfe143 SPIGOT-6249: Add Missing Effect Constants CraftBukkit Changes: 14928261 SPIGOT-6249: Add Missing Effect Constants 332335e1 SPIGOT-6731: "Nag author" message in CraftServer lists one author only 6cd975d0 SPIGOT-5732, SPIGOT-6387: Overhaul Hanging entities --- patches/api/Add-missing-effects.patch | 95 ++++++++++++++++++- .../Dont-send-unnecessary-sign-update.patch | 18 ++++ ...hanging-entities-that-are-not-ItemFr.patch | 25 ----- patches/server/misc-debugging-dumps.patch | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 6 files changed, 112 insertions(+), 32 deletions(-) create mode 100644 patches/server/Dont-send-unnecessary-sign-update.patch delete mode 100644 patches/server/Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch diff --git a/patches/api/Add-missing-effects.patch b/patches/api/Add-missing-effects.patch index dbdd16e601..3acd6f13a4 100644 --- a/patches/api/Add-missing-effects.patch +++ b/patches/api/Add-missing-effects.patch @@ -9,9 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/Effect.java +++ b/src/main/java/org/bukkit/Effect.java @@ -0,0 +0,0 @@ public enum Effect { - * The sound of an enderdragon growling + * block. */ - ENDERDRAGON_GROWL(3001, Type.SOUND), + OXIDISED_COPPER_SCRAPE(3005, Type.VISUAL), + // Paper start - add missing effects + /** + * The sound of a wither spawning @@ -27,50 +27,137 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + END_PORTAL_CREATED_IN_OVERWORLD(1038, Type.SOUND), + /** + * The sound of phantom's bites ++ * ++ * @deprecated use {@link #PHANTOM_BITE} + */ ++ @Deprecated(forRemoval = true) + PHANTOM_BITES(1039, Type.SOUND), + /** + * The sound of zombie converting to drowned zombie ++ * ++ * @deprecated use {@link #ZOMBIE_CONVERTED_TO_DROWNED} + */ ++ @Deprecated(forRemoval = true) + ZOMBIE_CONVERTS_TO_DROWNED(1040, Type.SOUND), + /** + * The sound of a husk converting to zombie by drowning ++ * ++ * @deprecated use {@link #HUSK_CONVERTED_TO_ZOMBIE} + */ ++ @Deprecated(forRemoval = true) + HUSK_CONVERTS_TO_ZOMBIE(1041, Type.SOUND), + /** + * The sound of a grindstone being used ++ * ++ * @deprecated use {@link #GRINDSTONE_USE} + */ ++ @Deprecated(forRemoval = true) + GRINDSTONE_USED(1042, Type.SOUND), + /** + * The sound of a book page being turned ++ * ++ * @deprecated use {@link #BOOK_PAGE_TURN} + */ ++ @Deprecated(forRemoval = true) + BOOK_PAGE_TURNED(1043, Type.SOUND), + /** + * Particles displayed when a composter composts ++ * ++ * @deprecated use {@link #COMPOSTER_FILL_ATTEMPT} + */ ++ @Deprecated(forRemoval = true) + COMPOSTER_COMPOSTS(1500, Type.VISUAL), + /** + * Particles displayed when lava converts a block (either water to stone, or + * removing existing blocks such as torches) ++ * ++ * @deprecated use {@link #LAVA_INTERACT} + */ ++ @Deprecated(forRemoval = true) + LAVA_CONVERTS_BLOCK(1501, Type.VISUAL), + /** + * Particles displayd when a redstone torch burns out ++ * ++ * @deprecated use {@link #REDSTONE_TORCH_BURNOUT} + */ ++ @Deprecated(forRemoval = true) + REDSTONE_TORCH_BURNS_OUT(1502, Type.VISUAL), + /** + * Particles displayed when an ender eye is placed ++ * ++ * @deprecated use {@link #END_PORTAL_FRAME_FILL} + */ ++ @Deprecated(forRemoval = true) + ENDER_EYE_PLACED(1503, Type.VISUAL), + /** + * Particles displayed when an ender dragon destroys block ++ * ++ * @deprecated use {@link #ENDER_DRAGON_DESTROY_BLOCK} + */ ++ @Deprecated(forRemoval = true) + ENDER_DRAGON_DESTROYS_BLOCK(2008, Type.VISUAL), + /** + * Particles displayed when a wet sponge vaporizes in nether. ++ * ++ * @deprecated use {@link #SPONGE_DRY} + */ -+ WET_SPONGE_VAPORIZES_IN_NETHER(2009, Type.VISUAL) -+ // Paper end ++ @Deprecated(forRemoval = true) ++ WET_SPONGE_VAPORIZES_IN_NETHER(2009, Type.VISUAL), ; ++ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); ++ // Paper end private final int id; + private final Type type; +@@ -0,0 +0,0 @@ public enum Effect { + + static { + for (Effect effect : values()) { ++ if (!isDeprecated(effect)) // Paper + BY_ID.put(effect.id, effect); + } + } + ++ // Paper start ++ private static boolean isDeprecated(Effect effect) { ++ try { ++ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class); ++ } catch (NoSuchFieldException e) { ++ LOGGER.error("Error getting effect enum field {}", effect.name(), e); ++ return false; ++ } ++ } ++ // Paper end ++ + /** + * Represents the type of an effect. + */ +diff --git a/src/test/java/org/bukkit/EffectTest.java b/src/test/java/org/bukkit/EffectTest.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/test/java/org/bukkit/EffectTest.java ++++ b/src/test/java/org/bukkit/EffectTest.java +@@ -0,0 +0,0 @@ import static org.junit.Assert.*; + import org.junit.Test; + + public class EffectTest { ++ private static final org.apache.logging.log4j.Logger LOGGER = org.apache.logging.log4j.LogManager.getLogger(); // Paper ++ + @Test + public void getById() { + for (Effect effect : Effect.values()) { ++ if (!isDeprecated(effect)) // Paper + assertThat(Effect.getById(effect.getId()), is(effect)); + } + } ++ ++ // Paper start ++ private static boolean isDeprecated(Effect effect) { ++ try { ++ return Effect.class.getDeclaredField(effect.name()).isAnnotationPresent(Deprecated.class); ++ } catch (NoSuchFieldException e) { ++ LOGGER.error("Error getting effect enum field {}", effect.name(), e); ++ return false; ++ } ++ } ++ // Paper end + } diff --git a/patches/server/Dont-send-unnecessary-sign-update.patch b/patches/server/Dont-send-unnecessary-sign-update.patch new file mode 100644 index 0000000000..5d46b83bed --- /dev/null +++ b/patches/server/Dont-send-unnecessary-sign-update.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Nassim Jahnke +Date: Sat, 11 Sep 2021 11:56:51 +0200 +Subject: [PATCH] Dont send unnecessary sign update + + +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, Ser + + if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) { + ServerGamePacketListenerImpl.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString()); ++ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32) // Paper + this.send(tileentity.getUpdatePacket()); // CraftBukkit + return; + } diff --git a/patches/server/Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch b/patches/server/Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch deleted file mode 100644 index 4a04a2673b..0000000000 --- a/patches/server/Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: MisterErwin -Date: Wed, 30 Oct 2019 16:57:54 +0100 -Subject: [PATCH] Fix spawning of hanging entities that are not ItemFrames and - can not face UP or DOWN - - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -@@ -0,0 +0,0 @@ public abstract class CraftRegionAccessor implements RegionAccessor { - height = 9; - } - -- BlockFace[] faces = new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH, BlockFace.UP, BlockFace.DOWN}; -+ // Paper start - In addition to d65a2576e40e58c8e446b330febe6799d13a604f do not check UP/DOWN for non item frames -+ // BlockFace[] faces = new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH, BlockFace.UP, BlockFace.DOWN}; -+ BlockFace[] faces = (ItemFrame.class.isAssignableFrom(clazz)) -+ ? new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH, BlockFace.UP, BlockFace.DOWN} -+ : new BlockFace[]{BlockFace.EAST, BlockFace.NORTH, BlockFace.WEST, BlockFace.SOUTH}; -+ // Paper end - final BlockPos pos = new BlockPos(x, y, z); - for (BlockFace dir : faces) { - net.minecraft.world.level.block.state.BlockState nmsBlock = this.getHandle().getBlockState(pos.relative(CraftBlock.blockFaceToNotch(dir))); diff --git a/patches/server/misc-debugging-dumps.patch b/patches/server/misc-debugging-dumps.patch index e83b6d6c55..380b737b89 100644 --- a/patches/server/misc-debugging-dumps.patch +++ b/patches/server/misc-debugging-dumps.patch @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - plugin.getDescription().getName(), + plugin.getDescription().getFullName(), "This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin" )); + if (console.isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread(worker.getThread(), "still running"); // Paper diff --git a/work/Bukkit b/work/Bukkit index 7da4c0be21..44cfe1432d 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 7da4c0be21e71bbe9498bc50c352dae39e7c6f2a +Subproject commit 44cfe1432dda2c12c919dcf63536d12cde650fe0 diff --git a/work/CraftBukkit b/work/CraftBukkit index 9217b523e5..1492826118 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 9217b523e5c101d0f998dac6ebb26bfc48ccdec1 +Subproject commit 149282611823e75c181316159665e9d2b54bf3de