From b7ab883a24fc402a86306dd389f31a5d8e321e15 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 6 Dec 2023 20:10:59 +0100 Subject: [PATCH] More compile fixes --- ...Add-API-for-resetting-a-single-score.patch | 2 +- ...Add-Raw-Byte-ItemStack-Serialization.patch | 2 +- patches/server/Adventure.patch | 8 ++----- patches/server/Basic-PlayerProfile-API.patch | 10 -------- .../server/Do-not-let-armorstands-drown.patch | 23 ------------------- .../server/Fill-Profile-Property-Events.patch | 10 +++++++- .../Fix-tripwire-state-inconsistency.patch | 9 ++++++++ ...ement-PlayerFlowerPotManipulateEvent.patch | 2 +- patches/server/Improve-ServerGUI.patch | 2 +- .../server/Make-the-GUI-graph-fancier.patch | 4 ++-- 10 files changed, 26 insertions(+), 46 deletions(-) delete mode 100644 patches/server/Do-not-let-armorstands-drown.patch diff --git a/patches/server/Add-API-for-resetting-a-single-score.patch b/patches/server/Add-API-for-resetting-a-single-score.patch index d46247b8e5..41071bc3b1 100644 --- a/patches/server/Add-API-for-resetting-a-single-score.patch +++ b/patches/server/Add-API-for-resetting-a-single-score.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @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/Add-Raw-Byte-ItemStack-Serialization.patch b/patches/server/Add-Raw-Byte-ItemStack-Serialization.patch index ef47ed6e92..5c3ea19fb3 100644 --- a/patches/server/Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/server/Add-Raw-Byte-ItemStack-Serialization.patch @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Adventure.patch b/patches/server/Adventure.patch index 6fc5e69bc4..6910a8ada4 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -1683,12 +1683,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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/Basic-PlayerProfile-API.patch b/patches/server/Basic-PlayerProfile-API.patch index 78af17ac4c..2cd6d4fbe9 100644 --- a/patches/server/Basic-PlayerProfile-API.patch +++ b/patches/server/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 @@ -498,15 +497,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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..00000000000000000000000000000000 + } + + @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/Do-not-let-armorstands-drown.patch b/patches/server/Do-not-let-armorstands-drown.patch deleted file mode 100644 index 7d19c8843b..0000000000 --- a/patches/server/Do-not-let-armorstands-drown.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java -@@ -0,0 +0,0 @@ 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/Fill-Profile-Property-Events.patch b/patches/server/Fill-Profile-Property-Events.patch index 2282e758e3..c5d92dfcdd 100644 --- a/patches/server/Fill-Profile-Property-Events.patch +++ b/patches/server/Fill-Profile-Property-Events.patch @@ -14,8 +14,16 @@ diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSession index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java +@@ -0,0 +0,0 @@ + 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; @@ -0,0 +0,0 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi - return super.getTextures(profile, requireSecure); + super(servicesKeySet, proxy, environment); } - @Override diff --git a/patches/server/Fix-tripwire-state-inconsistency.patch b/patches/server/Fix-tripwire-state-inconsistency.patch index 1db620881e..b2ae0657aa 100644 --- a/patches/server/Fix-tripwire-state-inconsistency.patch +++ b/patches/server/Fix-tripwire-state-inconsistency.patch @@ -59,6 +59,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Optional optional = state.getOptionalValue(TripWireHookBlock.FACING); if (optional.isPresent()) { +@@ -0,0 +0,0 @@ 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]; @@ -0,0 +0,0 @@ public class TripWireHookBlock extends Block { boolean flag7 = (Boolean) iblockdata2.getValue(TripWireBlock.POWERED); diff --git a/patches/server/Implement-PlayerFlowerPotManipulateEvent.patch b/patches/server/Implement-PlayerFlowerPotManipulateEvent.patch index 17abb09358..a3b0433659 100644 --- a/patches/server/Implement-PlayerFlowerPotManipulateEvent.patch +++ b/patches/server/Implement-PlayerFlowerPotManipulateEvent.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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/Improve-ServerGUI.patch b/patches/server/Improve-ServerGUI.patch index 11d1555f22..2a480d7ac7 100644 --- a/patches/server/Improve-ServerGUI.patch +++ b/patches/server/Improve-ServerGUI.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } 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/Make-the-GUI-graph-fancier.patch b/patches/server/Make-the-GUI-graph-fancier.patch index 8a4708dc6d..677df0e8cf 100644 --- a/patches/server/Make-the-GUI-graph-fancier.patch +++ b/patches/server/Make-the-GUI-graph-fancier.patch @@ -221,14 +221,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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; + }