mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-21 15:59:28 +00:00
53 lines
2.5 KiB
Diff
53 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Thu, 1 Dec 2022 00:12:14 +0100
|
|
Subject: [PATCH] Update boss bar within tick
|
|
|
|
License: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following mixin:
|
|
"me/jellysquid/mods/lithium/mixin/ai/raid/RaidMixin.java"
|
|
By: Angeline <jellysquid3@users.noreply.github.com>
|
|
As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
|
|
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
index dcbef04bbaab988096bf416163264833e84d1967..5c0e5803284bfc82c2dd8bba9ded0ba7aac4962a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
@@ -112,6 +112,7 @@ public class Raid {
|
|
private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry PDC_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
|
|
public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(PDC_TYPE_REGISTRY);
|
|
// Paper end
|
|
+ private boolean isBarDirty; // Gale - Lithium - update boss bar within tick
|
|
|
|
public Raid(int id, ServerLevel world, BlockPos pos) {
|
|
this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10);
|
|
@@ -291,6 +292,12 @@ public class Raid {
|
|
}
|
|
|
|
public void tick() {
|
|
+ // Gale start - Lithium - update boss bar within tick
|
|
+ if (this.isBarDirty) {
|
|
+ this.updateBossbarInternal();
|
|
+ this.isBarDirty = false;
|
|
+ }
|
|
+ // Gale end - Lithium - update boss bar within tick
|
|
if (!this.isStopped()) {
|
|
if (this.status == Raid.RaidStatus.ONGOING) {
|
|
boolean flag = this.active;
|
|
@@ -661,6 +668,12 @@ public class Raid {
|
|
}
|
|
|
|
public void updateBossbar() {
|
|
+ // Gale start - Lithium - update boss bar within tick
|
|
+ this.isBarDirty = true;
|
|
+ }
|
|
+
|
|
+ private void updateBossbarInternal() {
|
|
+ // Gale end - Lithium - update boss bar within tick
|
|
this.raidEvent.setProgress(Mth.clamp(this.getHealthOfLivingRaiders() / this.totalHealth, 0.0F, 1.0F));
|
|
}
|
|
|