From 1d6b275814fa82bd474e96bc70f879ba5ea6ecf3 Mon Sep 17 00:00:00 2001 From: Jason Penilla <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/Adventure.patch | 83 +++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 7 deletions(-) diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 46e1ebbb1d..de983f98e1 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -1565,13 +1565,6 @@ diff --git a/src/main/java/net/minecraft/world/BossEvent.java b/src/main/java/ne index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/BossEvent.java +++ b/src/main/java/net/minecraft/world/BossEvent.java -@@ -0,0 +0,0 @@ - package net.minecraft.world; - -+import io.papermc.paper.adventure.PaperAdventure; - import java.util.UUID; - import net.minecraft.ChatFormatting; - import net.minecraft.network.chat.Component; @@ -0,0 +0,0 @@ public abstract class BossEvent { protected boolean darkenScreen; protected boolean playBossMusic; @@ -1580,6 +1573,82 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public BossEvent(UUID uuid, Component name, BossEvent.BossBarColor color, BossEvent.BossBarOverlay style) { this.id = uuid; +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java