From 6fd92758670a4c38ceb1b4dc6ed671547185f414 Mon Sep 17 00:00:00 2001 From: Jason <11360596+jpenilla@users.noreply.github.com> Date: Sat, 3 Jul 2021 16:26:13 -0700 Subject: [PATCH] Fix Bossbar updating (closes #6061) (#6076) --- patches/server/0010-Adventure.patch | 87 ++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index f3b1b11eac..07c04a5928 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -1562,17 +1562,10 @@ index 524428ee32d18c76c0e9c46bbac3664888b1b35c..186c745401a3320432f4aadfadfc6ef4 // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/BossEvent.java b/src/main/java/net/minecraft/world/BossEvent.java -index d289e8321a62f7c8d1e5b83f038e7331a26fc24e..658aff27155b32a0323f55152c7315fdc7b4a82d 100644 +index d289e8321a62f7c8d1e5b83f038e7331a26fc24e..58716ba8f8d12a410bdc66ccef6a61c62fddfbb7 100644 --- a/src/main/java/net/minecraft/world/BossEvent.java +++ b/src/main/java/net/minecraft/world/BossEvent.java -@@ -1,5 +1,6 @@ - package net.minecraft.world; - -+import io.papermc.paper.adventure.PaperAdventure; - import java.util.UUID; - import net.minecraft.ChatFormatting; - import net.minecraft.network.chat.Component; -@@ -13,6 +14,7 @@ public abstract class BossEvent { +@@ -13,6 +13,7 @@ public abstract class BossEvent { protected boolean darkenScreen; protected boolean playBossMusic; protected boolean createWorldFog; @@ -1580,6 +1573,82 @@ index d289e8321a62f7c8d1e5b83f038e7331a26fc24e..658aff27155b32a0323f55152c7315fd public BossEvent(UUID uuid, Component name, BossEvent.BossBarColor color, BossEvent.BossBarOverlay style) { this.id = uuid; +@@ -27,61 +28,75 @@ public abstract class BossEvent { + } + + public Component getName() { ++ if (this.adventure != null) return io.papermc.paper.adventure.PaperAdventure.asVanilla(this.adventure.name()); // Paper + return this.name; + } + + public void setName(Component name) { ++ if (this.adventure != null) this.adventure.name(io.papermc.paper.adventure.PaperAdventure.asAdventure(name)); // Paper + this.name = name; + } + + public float getProgress() { ++ if (this.adventure != null) return this.adventure.progress(); // Paper + return this.progress; + } + + public void setProgress(float percentage) { ++ if (this.adventure != null) this.adventure.progress(percentage); // Paper + this.progress = percentage; + } + + public BossEvent.BossBarColor getColor() { ++ if (this.adventure != null) return io.papermc.paper.adventure.PaperAdventure.asVanilla(this.adventure.color()); // Paper + return this.color; + } + + public void setColor(BossEvent.BossBarColor color) { ++ if (this.adventure != null) this.adventure.color(io.papermc.paper.adventure.PaperAdventure.asAdventure(color)); // Paper + this.color = color; + } + + public BossEvent.BossBarOverlay getOverlay() { ++ if (this.adventure != null) return io.papermc.paper.adventure.PaperAdventure.asVanilla(this.adventure.overlay()); // Paper + return this.overlay; + } + + public void setOverlay(BossEvent.BossBarOverlay style) { ++ if (this.adventure != null) this.adventure.overlay(io.papermc.paper.adventure.PaperAdventure.asAdventure(style)); // Paper + this.overlay = style; + } + + public boolean shouldDarkenScreen() { ++ if (this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.DARKEN_SCREEN); // Paper + return this.darkenScreen; + } + + public BossEvent setDarkenScreen(boolean darkenSky) { ++ if (this.adventure != null) io.papermc.paper.adventure.PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.DARKEN_SCREEN, darkenSky); // Paper + this.darkenScreen = darkenSky; + return this; + } + + public boolean shouldPlayBossMusic() { ++ if (this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC); // Paper + return this.playBossMusic; + } + + public BossEvent setPlayBossMusic(boolean dragonMusic) { ++ if (this.adventure != null) io.papermc.paper.adventure.PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC, dragonMusic); // Paper + this.playBossMusic = dragonMusic; + return this; + } + + public BossEvent setCreateWorldFog(boolean thickenFog) { ++ if (this.adventure != null) io.papermc.paper.adventure.PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG, thickenFog); // Paper + this.createWorldFog = thickenFog; + return this; + } + + public boolean shouldCreateWorldFog() { ++ if (this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG); // Paper + return this.createWorldFog; + } + diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java index 7a0e7961df1e62b311ea2ecc76d7343a8646723b..6859fafa42527d45366018f737c19e6c3777d152 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java