From 1d028f3853eaa3bb193d686b9bc213ff8401dd0d Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 6 Dec 2023 20:10:59 +0100 Subject: [PATCH] More compile fixes --- patches/server/0010-Adventure.patch | 12 ++++------ .../0129-Do-not-let-armorstands-drown.patch | 23 ------------------- .../server/0139-Basic-PlayerProfile-API.patch | 14 ++--------- .../0172-Fill-Profile-Property-Events.patch | 14 ++++++++--- .../0350-Make-the-GUI-graph-fancier.patch | 6 ++--- ...Add-Raw-Byte-ItemStack-Serialization.patch | 4 ++-- ...ement-PlayerFlowerPotManipulateEvent.patch | 4 ++-- patches/server/0554-Improve-ServerGUI.patch | 4 ++-- ...Add-API-for-resetting-a-single-score.patch | 4 ++-- ...729-Fix-tripwire-state-inconsistency.patch | 11 ++++++++- 10 files changed, 38 insertions(+), 58 deletions(-) delete mode 100644 patches/server/0129-Do-not-let-armorstands-drown.patch diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index cc00ea854a..9c58467056 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -1659,10 +1659,10 @@ index db93483cfee13ca4303d7452ecbb47507dc5f89e..b836a85ce3a4374e94061fe9368e86a6 public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server)); diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java -index 979ea69678319338c543185ba026ad0699a388d6..5885657a1bf9fe5b93cb711d5d1f723642756352 100644 +index 979ea69678319338c543185ba026ad0699a388d6..03bdc7531fad9a69a86f2afd4a4ebe195d892dd5 100644 --- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java -@@ -51,17 +51,25 @@ public class MessageArgument implements SignedArgument +@@ -51,17 +51,21 @@ public class MessageArgument implements SignedArgument private static void resolveSignedMessage(Consumer callback, CommandSourceStack source, PlayerChatMessage message) { MinecraftServer minecraftServer = source.getServer(); CompletableFuture completableFuture = filterPlainText(source, message); @@ -1683,12 +1683,8 @@ index 979ea69678319338c543185ba026ad0699a388d6..5885657a1bf9fe5b93cb711d5d1f7236 - Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent()); - callback.accept(message.withUnsignedContent(component)); + // Paper start -+ source.getChatMessageChainer().append(executor -> { -+ CompletableFuture componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent()); -+ return componentFuture.thenAcceptAsync((result) -> { -+ callback.accept(message.withUnsignedContent(result.component())); -+ }, executor); -+ }); ++ CompletableFuture componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent()); ++ source.getChatMessageChainer().append(() -> componentFuture.thenAccept((result) -> callback.accept(message.withUnsignedContent(result.component())))); + // Paper end } diff --git a/patches/server/0129-Do-not-let-armorstands-drown.patch b/patches/server/0129-Do-not-let-armorstands-drown.patch deleted file mode 100644 index 2d5e0eda03..0000000000 --- a/patches/server/0129-Do-not-let-armorstands-drown.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sat, 18 Feb 2017 19:29:58 -0600 -Subject: [PATCH] Do not let armorstands drown - - -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 d04d0b9cbf91beb57da7e37e72f8e7c98cf6cf4c..c9c773cce59e795ed0d8449a6e70b4b968a4e5e8 100644 ---- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -946,5 +946,12 @@ public class ArmorStand extends LivingEntity { - super.move(type, movement); - } - } -+ -+ // Paper start -+ @Override -+ public boolean canBreatheUnderwater() { // Skips a bit of damage handling code, probably a micro-optimization -+ return true; -+ } -+ // Paper end - // Paper end - } diff --git a/patches/server/0139-Basic-PlayerProfile-API.patch b/patches/server/0139-Basic-PlayerProfile-API.patch index c4ee013db6..ea11e9a8d5 100644 --- a/patches/server/0139-Basic-PlayerProfile-API.patch +++ b/patches/server/0139-Basic-PlayerProfile-API.patch @@ -11,7 +11,6 @@ public org.bukkit.craftbukkit.profile.CraftPlayerTextures public org.bukkit.craftbukkit.profile.CraftPlayerTextures copyFrom(Lorg/bukkit/profile/PlayerTextures;)V public org.bukkit.craftbukkit.profile.CraftPlayerTextures rebuildPropertyIfDirty()V public org.bukkit.craftbukkit.profile.CraftPlayerProfile toString(Lcom/mojang/authlib/properties/PropertyMap;)Ljava/lang/String; -# needed to maintain visibility with overridden methods public org.bukkit.craftbukkit.profile.CraftPlayerProfile getProperty(Ljava/lang/String;)Lcom/mojang/authlib/properties/Property; public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/String;Lcom/mojang/authlib/properties/Property;)V @@ -491,22 +490,18 @@ index 0000000000000000000000000000000000000000..7b9e797b42c88b17d6a7c590a423f4e8 +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java new file mode 100644 -index 0000000000000000000000000000000000000000..ea906c9942be4c37b0daf866c759771af0b1e0ed +index 0000000000000000000000000000000000000000..985e6fc43a0946943847e0c283426242ef594a26 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -@@ -0,0 +1,31 @@ +@@ -0,0 +1,22 @@ +package com.destroystokyo.paper.profile; + +import com.mojang.authlib.Environment; -+import com.mojang.authlib.GameProfile; -+import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.yggdrasil.ProfileResult; +import com.mojang.authlib.yggdrasil.ServicesKeySet; -+import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; + +import java.net.Proxy; -+import java.util.Map; +import java.util.UUID; +import org.jetbrains.annotations.Nullable; + @@ -517,11 +512,6 @@ index 0000000000000000000000000000000000000000..ea906c9942be4c37b0daf866c759771a + } + + @Override -+ public Map getTextures(GameProfile profile, boolean requireSecure) { -+ return super.getTextures(profile, requireSecure); -+ } -+ -+ @Override + public @Nullable ProfileResult fetchProfile(final UUID profileId, final boolean requireSecure) { + return super.fetchProfile(profileId, requireSecure); + } diff --git a/patches/server/0172-Fill-Profile-Property-Events.patch b/patches/server/0172-Fill-Profile-Property-Events.patch index 61905d003c..68239bfad1 100644 --- a/patches/server/0172-Fill-Profile-Property-Events.patch +++ b/patches/server/0172-Fill-Profile-Property-Events.patch @@ -11,11 +11,19 @@ If Mojang API does need to be hit, event fire so you can get the results. This is useful for implementing a ProfileCache for Player Skulls diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -index ea906c9942be4c37b0daf866c759771af0b1e0ed..48fcfe223f807ccb903804adfead4b97beb2475d 100644 +index 985e6fc43a0946943847e0c283426242ef594a26..d577384797bb381eb57437f57b726ea8e4feb80b 100644 --- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -@@ -24,7 +24,21 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi - return super.getTextures(profile, requireSecure); +@@ -1,6 +1,7 @@ + package com.destroystokyo.paper.profile; + + import com.mojang.authlib.Environment; ++import com.mojang.authlib.GameProfile; + import com.mojang.authlib.yggdrasil.ProfileResult; + import com.mojang.authlib.yggdrasil.ServicesKeySet; + import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; +@@ -15,7 +16,21 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi + super(servicesKeySet, proxy, environment); } - @Override diff --git a/patches/server/0350-Make-the-GUI-graph-fancier.patch b/patches/server/0350-Make-the-GUI-graph-fancier.patch index 2768fc5d7c..3501af3b64 100644 --- a/patches/server/0350-Make-the-GUI-graph-fancier.patch +++ b/patches/server/0350-Make-the-GUI-graph-fancier.patch @@ -156,7 +156,7 @@ index 0000000000000000000000000000000000000000..537bc6213545e8ff1b7b51bc4b27fd5b +} diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java new file mode 100644 -index 0000000000000000000000000000000000000000..23239679d6584f1088b2b94c46eb9a5c1f9ad91d +index 0000000000000000000000000000000000000000..48e0b8a50090735ac44d03bdff22010c60b0d7e5 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java @@ -0,0 +1,73 @@ @@ -221,14 +221,14 @@ index 0000000000000000000000000000000000000000..23239679d6584f1088b2b94c46eb9a5c + Vector vector = new Vector<>(); + vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)"); + vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb"); -+ vector.add("Avg tick: " + DECIMAL_FORMAT.format(getAverage(server.tickTimes)) + " ms"); ++ vector.add("Avg tick: " + DECIMAL_FORMAT.format(this.getAverage(server.getTickTimesNanos())) + " ms"); + setListData(vector); + } + + public double getAverage(long[] tickTimes) { + long total = 0L; + for (long value : tickTimes) { -+ total += value; ++ total += value * 1000; + } + return ((double) total / (double) tickTimes.length) * 1.0E-6D; + } diff --git a/patches/server/0359-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/server/0359-Add-Raw-Byte-ItemStack-Serialization.patch index bdcf703674..afd9646f91 100644 --- a/patches/server/0359-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/server/0359-Add-Raw-Byte-ItemStack-Serialization.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e31ead0d99203a018757cb2e765b5d28dd373eef..a394298df60ddd0aa709f9e250520da9db8c9589 100644 +index e31ead0d99203a018757cb2e765b5d28dd373eef..2ff5d2c357a4832e2624ef53fb0110d61fddc6fc 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -458,6 +458,52 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -50,7 +50,7 @@ index e31ead0d99203a018757cb2e765b5d28dd373eef..a394298df60ddd0aa709f9e250520da9 + CompoundTag compound; + try { + compound = net.minecraft.nbt.NbtIo.readCompressed( -+ new java.io.ByteArrayInputStream(data) ++ new java.io.ByteArrayInputStream(data), net.minecraft.nbt.NbtAccounter.unlimitedHeap() + ); + } catch (IOException ex) { + throw new RuntimeException(ex); diff --git a/patches/server/0514-Implement-PlayerFlowerPotManipulateEvent.patch b/patches/server/0514-Implement-PlayerFlowerPotManipulateEvent.patch index 0ef6459121..112c7c7dde 100644 --- a/patches/server/0514-Implement-PlayerFlowerPotManipulateEvent.patch +++ b/patches/server/0514-Implement-PlayerFlowerPotManipulateEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java -index c450faf8c043665eab020141f3c27e3d9890cb86..f8d76e05a1b5ed25cbe8e2adeb63a748ff0fe3d7 100644 +index c450faf8c043665eab020141f3c27e3d9890cb86..d667526aa8132d34437f00dff5457ca9f73cef00 100644 --- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java @@ -66,6 +66,25 @@ public class FlowerPotBlock extends Block { @@ -17,7 +17,7 @@ index c450faf8c043665eab020141f3c27e3d9890cb86..f8d76e05a1b5ed25cbe8e2adeb63a748 + boolean placing = bl2; + org.bukkit.block.Block bukkitblock = org.bukkit.craftbukkit.block.CraftBlock.at(world, pos); + org.bukkit.inventory.ItemStack bukkititemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemStack); -+ org.bukkit.Material mat = org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(content); ++ org.bukkit.Material mat = org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(this.potted); + org.bukkit.inventory.ItemStack bukkititemstack1 = new org.bukkit.inventory.ItemStack(mat, 1); + org.bukkit.inventory.ItemStack whichitem = placing ? bukkititemstack : bukkititemstack1; + diff --git a/patches/server/0554-Improve-ServerGUI.patch b/patches/server/0554-Improve-ServerGUI.patch index 35918b7e36..2ae5d9262e 100644 --- a/patches/server/0554-Improve-ServerGUI.patch +++ b/patches/server/0554-Improve-ServerGUI.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Improve ServerGUI - Show tps in the server stats diff --git a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java -index 23239679d6584f1088b2b94c46eb9a5c1f9ad91d..fa56cd09102a89692b42f1d14257990508c5c720 100644 +index 48e0b8a50090735ac44d03bdff22010c60b0d7e5..066b9e4c4f0e7773548eda045cdd1ca8445221d2 100644 --- a/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java +++ b/src/main/java/com/destroystokyo/paper/gui/RAMDetails.java @@ -57,9 +57,18 @@ public class RAMDetails extends JList { @@ -23,7 +23,7 @@ index 23239679d6584f1088b2b94c46eb9a5c1f9ad91d..fa56cd09102a89692b42f1d142579905 + } vector.add("Memory use: " + (data.getUsedMem() / 1024L / 1024L) + " mb (" + (data.getFree() * 100L / data.getMax()) + "% free)"); vector.add("Heap: " + (data.getTotal() / 1024L / 1024L) + " / " + (data.getMax() / 1024L / 1024L) + " mb"); - vector.add("Avg tick: " + DECIMAL_FORMAT.format(getAverage(server.tickTimes)) + " ms"); + vector.add("Avg tick: " + DECIMAL_FORMAT.format(this.getAverage(server.getTickTimesNanos())) + " ms"); + vector.add("TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg)); + setListData(vector); diff --git a/patches/server/0667-Add-API-for-resetting-a-single-score.patch b/patches/server/0667-Add-API-for-resetting-a-single-score.patch index 9b1ff4a407..0fc3bdf5fe 100644 --- a/patches/server/0667-Add-API-for-resetting-a-single-score.patch +++ b/patches/server/0667-Add-API-for-resetting-a-single-score.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add API for resetting a single score It was only possible to reset all scores for a specific entry, instead of resetting only specific scores. diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java -index a7f53c135bae2a464e7cd28bf8e990d692c63d63..426a99e839986eb9c25cf4e65191f5a5a1efab6c 100644 +index a7f53c135bae2a464e7cd28bf8e990d692c63d63..be020d6b686c1ad5bd8b7cee0b6050304d434022 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScore.java @@ -68,4 +68,12 @@ final class CraftScore implements Score { @@ -18,7 +18,7 @@ index a7f53c135bae2a464e7cd28bf8e990d692c63d63..426a99e839986eb9c25cf4e65191f5a5 + @Override + public void resetScore() { + Scoreboard board = this.objective.checkState().board; -+ board.resetPlayerScore(entry, this.objective.getHandle()); ++ board.resetSinglePlayerScore(entry, this.objective.getHandle()); + } + // Paper end } diff --git a/patches/server/0729-Fix-tripwire-state-inconsistency.patch b/patches/server/0729-Fix-tripwire-state-inconsistency.patch index 00c7065527..49aa2d69f5 100644 --- a/patches/server/0729-Fix-tripwire-state-inconsistency.patch +++ b/patches/server/0729-Fix-tripwire-state-inconsistency.patch @@ -41,7 +41,7 @@ index bbb7d1b03c78758d608e89129aacec151242831c..1a0c5fb62e80681604110e95c1ae7b36 } else if (iblockdata1.is((Block) this)) { ++k; diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java -index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..69629cc135e2b18725335bd2b91537021af2139a 100644 +index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..f922db802ae9fd05ce4b3b8d16531d9f7f458412 100644 --- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java @@ -118,7 +118,13 @@ public class TripWireHookBlock extends Block { @@ -59,6 +59,15 @@ index 02b62ac13d4968f80cb0ae3702755d0f1d95e692..69629cc135e2b18725335bd2b9153702 Optional optional = state.getOptionalValue(TripWireHookBlock.FACING); if (optional.isPresent()) { +@@ -126,7 +132,7 @@ public class TripWireHookBlock extends Block { + boolean flag2 = (Boolean) state.getOptionalValue(TripWireHookBlock.ATTACHED).orElse(false); + boolean flag3 = (Boolean) state.getOptionalValue(TripWireHookBlock.POWERED).orElse(false); + Block block = state.getBlock(); +- boolean flag4 = !flag; ++ boolean flag4 = !beingRemoved; // Paper + boolean flag5 = false; + int j = 0; + BlockState[] aiblockdata = new BlockState[42]; @@ -156,6 +162,7 @@ public class TripWireHookBlock extends Block { boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED);