mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
80 lines
4.6 KiB
Diff
80 lines
4.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: jellysquid3 <jellysquid3@users.noreply.github.com>
|
|
Date: Tue, 18 Jan 2022 10:37:18 -0500
|
|
Subject: [PATCH] lithium: ai.raid
|
|
|
|
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
|
|
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
|
|
|
|
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 08b18428e867baf14f551beb72e3875b0c420639..d43927cdc77342d3fa03ae12f099fec93f473010 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
@@ -269,7 +269,16 @@ public class Raid {
|
|
this.status = Raid.RaidStatus.STOPPED;
|
|
}
|
|
|
|
+ private boolean isBarDirty; // JettPack
|
|
public void tick() {
|
|
+ // JettPack start - lithium: ai.raid
|
|
+ if (this.isBarDirty) {
|
|
+ this.raidEvent.setProgress(Mth.clamp(this.getHealthOfLivingRaiders() / this.totalHealth, 0.0F, 1.0F));
|
|
+
|
|
+ this.isBarDirty = false;
|
|
+ }
|
|
+ // JettPack end
|
|
+
|
|
if (!this.isStopped()) {
|
|
if (this.status == Raid.RaidStatus.ONGOING) {
|
|
boolean flag = this.active;
|
|
@@ -638,7 +647,7 @@ public class Raid {
|
|
}
|
|
|
|
public void updateBossbar() {
|
|
- this.raidEvent.setProgress(Mth.clamp(this.getHealthOfLivingRaiders() / this.totalHealth, 0.0F, 1.0F));
|
|
+ this.isBarDirty = true; // JettPack - lithium: ai.raid
|
|
}
|
|
|
|
public float getHealthOfLivingRaiders() {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
|
index e5ccbaf72f29731f1d1aa939b9297b644a408cd4..940fcebe1e1ab7d249487d58958b24b62fb8eaab 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
|
@@ -46,8 +46,9 @@ import net.minecraft.world.phys.Vec3;
|
|
public abstract class Raider extends PatrollingMonster {
|
|
|
|
protected static final EntityDataAccessor<Boolean> IS_CELEBRATING = SynchedEntityData.defineId(Raider.class, EntityDataSerializers.BOOLEAN);
|
|
+ public static final ItemStack CACHED_OMINOUS_BANNER = Raid.getLeaderBannerInstance(); // JettPack - lithium: ai.raid
|
|
static final Predicate<ItemEntity> ALLOWED_ITEMS = (entityitem) -> {
|
|
- return !entityitem.hasPickUpDelay() && entityitem.isAlive() && ItemStack.matches(entityitem.getItem(), Raid.getLeaderBannerInstance());
|
|
+ return !entityitem.hasPickUpDelay() && entityitem.isAlive() && ItemStack.matches(entityitem.getItem(), CACHED_OMINOUS_BANNER); // JettPack - lithium: ai.raid
|
|
};
|
|
@Nullable
|
|
protected Raid raid;
|
|
@@ -149,7 +150,7 @@ public abstract class Raider extends PatrollingMonster {
|
|
}
|
|
}
|
|
|
|
- if (!itemstack.isEmpty() && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance()) && entityhuman != null) {
|
|
+ if (!itemstack.isEmpty() && ItemStack.matches(itemstack, CACHED_OMINOUS_BANNER) && entityhuman != null) { // JettPack - lithium: ai.raid
|
|
MobEffectInstance mobeffect = entityhuman.getEffect(MobEffects.BAD_OMEN);
|
|
byte b0 = 1;
|
|
int i;
|
|
@@ -311,6 +312,7 @@ public abstract class Raider extends PatrollingMonster {
|
|
public class ObtainRaidLeaderBannerGoal<T extends Raider> extends Goal {
|
|
|
|
private final T mob;
|
|
+ private static final ItemStack CACHED_OMINOUS_BANNER = Raid.getLeaderBannerInstance(); // JettPack
|
|
|
|
public ObtainRaidLeaderBannerGoal(T entityraider) { // CraftBukkit - decompile error
|
|
this.mob = entityraider;
|
|
@@ -322,7 +324,7 @@ public abstract class Raider extends PatrollingMonster {
|
|
if (!this.mob.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
|
|
Raid raid = this.mob.getCurrentRaid();
|
|
|
|
- if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance())) {
|
|
+ if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), CACHED_OMINOUS_BANNER)) { // JettPack - lithium: ai.raid
|
|
Raider entityraider = raid.getLeader(this.mob.getWave());
|
|
|
|
if (entityraider == null || !entityraider.isAlive()) {
|