56 lines
3.3 KiB
Diff
56 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
|
Date: Fri, 15 Aug 2025 02:29:30 +0800
|
|
Subject: [PATCH] Compatibility fix for Raid Revert and Cross Region Damage
|
|
Trace
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
|
|
index 29919b8f3c05c8ffaf66f86e441778eeefb293b1..1e820f34636f415ef78cdfbed06c6952a3cf1c0b 100644
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1234,6 +1234,30 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
|
|
}
|
|
}
|
|
|
|
+ // Lophine Start - raid revert adapt Cross Region Damage trace
|
|
+ public boolean addEffect(final MobEffectInstance effectInstance, EntityPotionEffectEvent.Cause cause, boolean fireEvent, boolean async) {
|
|
+ if (!async || ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this)) {
|
|
+ return addEffect(effectInstance, this, cause, fireEvent);
|
|
+ } else if (fun.bm.lophine.config.modules.experiment.EntityDamageSourceTraceConfig.enabled) {
|
|
+ postToAddEffect(effectInstance, this, cause, fireEvent);
|
|
+ return true;
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
+
|
|
+ private void postToAddEffect(final MobEffectInstance effectInstance, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause, boolean fireEvent) {
|
|
+ if (entity != null)
|
|
+ entity.getBukkitEntity().taskScheduler.schedule((Entity nmsEntity) -> {
|
|
+ try {
|
|
+ if (nmsEntity.isRemoved()) return;
|
|
+ addEffect(effectInstance, nmsEntity, cause, fireEvent);
|
|
+ } catch (Throwable ex) {
|
|
+ LOGGER.error(ex.getMessage(), ex);
|
|
+ }
|
|
+ }, null, 1L);
|
|
+ }
|
|
+ // Lophine End - raid revert adapt Cross Region Damage trace
|
|
+
|
|
public boolean canBeAffected(final MobEffectInstance newEffect) {
|
|
if (this.is(EntityTypeTags.IMMUNE_TO_INFESTED)) {
|
|
return !newEffect.is(MobEffects.INFESTED);
|
|
diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java
|
|
index 1a51da9171c13711e106731c360051d183a40893..7094a67959e9747b2dfa55a5f5a3e90552d35466 100644
|
|
--- a/net/minecraft/world/entity/raid/Raider.java
|
|
+++ b/net/minecraft/world/entity/raid/Raider.java
|
|
@@ -158,7 +158,7 @@ public abstract class Raider extends PatrollingMonster {
|
|
net.minecraft.world.effect.MobEffectInstance mobeffect1 = new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.BAD_OMEN, 120000, amp, false, false, true);
|
|
|
|
if (serverLevel.getGameRules().get(net.minecraft.world.level.gamerules.GameRules.RAIDS)) {
|
|
- entityhuman.addEffect(mobeffect1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN); // CraftBukkit
|
|
+ entityhuman.addEffect(mobeffect1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN, true, fun.bm.lophine.config.modules.experiment.EntityDamageSourceTraceConfig.enabled); // CraftBukkit // Lophine - raid revert adapt Cross Region Damage trace
|
|
}
|
|
this.setPatrolLeader(false);
|
|
}
|