From 286f49b866c16d068c26a84c155617681f68220a Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 6 Dec 2023 10:07:47 -0800 Subject: [PATCH] fix more compile issues --- patches/server/Add-more-advancement-API.patch | 8 ++++---- patches/server/Adventure.patch | 4 ++-- ...ute-chunk-tasks-fairly-for-worlds-while-waiting-.patch | 5 ++--- patches/server/More-PotionEffectType-API.patch | 5 ----- .../server/Update-itemstack-legacy-name-and-lore.patch | 4 ++-- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/patches/server/Add-more-advancement-API.patch b/patches/server/Add-more-advancement-API.patch index 82f301e7fb..326b755aee 100644 --- a/patches/server/Add-more-advancement-API.patch +++ b/patches/server/Add-more-advancement-API.patch @@ -19,8 +19,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import io.papermc.paper.adventure.PaperAdventure; +import net.kyori.adventure.text.Component; +import net.minecraft.advancements.Advancement; ++import net.minecraft.advancements.AdvancementType; +import net.minecraft.advancements.DisplayInfo; -+import net.minecraft.advancements.FrameType; +import org.bukkit.NamespacedKey; +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.craftbukkit.util.CraftNamespacedKey; @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public @NotNull Frame frame() { -+ return asPaperFrame(this.handle.getFrame()); ++ return asPaperFrame(this.handle.getType()); + } + + @Override @@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public @Nullable NamespacedKey backgroundPath() { -+ return this.handle.getBackground() == null ? null : CraftNamespacedKey.fromMinecraft(this.handle.getBackground()); ++ return this.handle.getBackground().map(CraftNamespacedKey::fromMinecraft).orElse(null); + } + + @Override @@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return PaperAdventure.asAdventure(Advancement.decorateName(java.util.Objects.requireNonNull(this.handle, "cannot build display name for null handle, invalid state"))); + } + -+ public static @NotNull Frame asPaperFrame(@NotNull FrameType frameType) { ++ public static @NotNull Frame asPaperFrame(final @NotNull AdvancementType frameType) { + return switch (frameType) { + case TASK -> Frame.TASK; + case CHALLENGE -> Frame.CHALLENGE; diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 26d6cf2132..6fc5e69bc4 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.network.chat.ComponentContents; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.Style; -+import net.minecraft.network.chat.contents.LiteralContents; ++import net.minecraft.network.chat.contents.PlainTextContents; +import net.minecraft.util.FormattedCharSequence; +import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.jetbrains.annotations.Nullable; @@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public ComponentContents getContents() { + if (this.adventure instanceof TextComponent) { -+ return new LiteralContents(((TextComponent) this.adventure).content()); ++ return PlainTextContents.create(((TextComponent) this.adventure).content()); + } else { + return this.deepConverted().getContents(); + } diff --git a/patches/server/Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch b/patches/server/Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch index 40a6666aa1..b690942d94 100644 --- a/patches/server/Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch +++ b/patches/server/Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch @@ -20,9 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.tickRateManager.isSprinting() || this.haveTime()) { Iterator iterator = this.getAllLevels().iterator(); - while (iterator.hasNext()) { -- ServerLevel worldserver = (ServerLevel) iterator.next(); -+ WorldServer worldserver = (WorldServer) iterator.next(); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop getEffectAttributes() { + // re-create map each time because a nms MobEffect can have its attributes modified + final java.util.Map attributeMap = new java.util.HashMap<>(); diff --git a/patches/server/Update-itemstack-legacy-name-and-lore.patch b/patches/server/Update-itemstack-legacy-name-and-lore.patch index 56b7aed5e8..54f02abdbb 100644 --- a/patches/server/Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/Update-itemstack-legacy-name-and-lore.patch @@ -44,9 +44,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + private net.minecraft.nbt.StringTag convert(String json) { + Component component = Component.Serializer.fromJson(json); -+ if (component.getContents() instanceof net.minecraft.network.chat.contents.LiteralContents literalContents && literalContents.text().contains("\u00A7") && component.getSiblings().isEmpty()) { ++ if (component.getContents() instanceof final net.minecraft.network.chat.contents.PlainTextContents plainTextContents && plainTextContents.text().contains("\u00A7") && component.getSiblings().isEmpty()) { + // Only convert if the root component is a single comp with legacy in it, don't convert already normal components -+ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(literalContents.text())[0]; ++ component = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(plainTextContents.text())[0]; + } + return net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(component)); + }