aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/server/bossevents/CustomBossEvent.java.patch
blob: ef8a8c406443470bfe460e1edf45e9599f26c88a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- a/net/minecraft/server/bossevents/CustomBossEvent.java
+++ b/net/minecraft/server/bossevents/CustomBossEvent.java
@@ -17,6 +17,10 @@
 import net.minecraft.server.level.ServerPlayer;
 import net.minecraft.util.Mth;
 import net.minecraft.world.BossEvent;
+// CraftBukkit start
+import org.bukkit.boss.KeyedBossBar;
+import org.bukkit.craftbukkit.boss.CraftKeyedBossbar;
+// CraftBukkit end
 
 public class CustomBossEvent extends ServerBossEvent {
 
@@ -24,10 +28,20 @@
     private final Set<UUID> players = Sets.newHashSet();
     private int value;
     private int max = 100;
+    // CraftBukkit start
+    private KeyedBossBar bossBar;
 
-    public CustomBossEvent(ResourceLocation resourcelocation, Component component) {
-        super(component, BossEvent.BossBarColor.WHITE, BossEvent.BossBarOverlay.PROGRESS);
-        this.id = resourcelocation;
+    public KeyedBossBar getBukkitEntity() {
+        if (bossBar == null) {
+            bossBar = new CraftKeyedBossbar(this);
+        }
+        return bossBar;
+    }
+    // CraftBukkit end
+
+    public CustomBossEvent(ResourceLocation id, Component name) {
+        super(name, BossEvent.BossBarColor.WHITE, BossEvent.BossBarOverlay.PROGRESS);
+        this.id = id;
         this.setProgress(0.0F);
     }