From 74e960b7b07ba9366d58c8cb792dfbefef815e41 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Wed, 9 Apr 2025 02:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8D=AF=E6=B0=B4=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../atsuishio/superbwarfare/mobeffect/BurnMobEffect.java | 4 +--- .../atsuishio/superbwarfare/mobeffect/ShockMobEffect.java | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/mobeffect/BurnMobEffect.java b/src/main/java/com/atsuishio/superbwarfare/mobeffect/BurnMobEffect.java index 73cc587a3..05d83da5c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mobeffect/BurnMobEffect.java +++ b/src/main/java/com/atsuishio/superbwarfare/mobeffect/BurnMobEffect.java @@ -20,7 +20,6 @@ import net.neoforged.neoforge.event.entity.living.MobEffectEvent; import net.neoforged.neoforge.event.tick.EntityTickEvent; import net.neoforged.neoforge.network.PacketDistributor; -// TODO 解决加上效果就立刻消失的问题 @EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME) public class BurnMobEffect extends MobEffect { @@ -44,8 +43,7 @@ public class BurnMobEffect extends MobEffect { player.level().playSound(null, player.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5)); } - - return false; + return true; } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/mobeffect/ShockMobEffect.java b/src/main/java/com/atsuishio/superbwarfare/mobeffect/ShockMobEffect.java index 6096bd159..93573063c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mobeffect/ShockMobEffect.java +++ b/src/main/java/com/atsuishio/superbwarfare/mobeffect/ShockMobEffect.java @@ -50,7 +50,7 @@ public class ShockMobEffect extends MobEffect { player.level().playSound(null, player.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5)); } - return false; + return true; } @Override @@ -58,13 +58,12 @@ public class ShockMobEffect extends MobEffect { return duration % 20 == 0; } - @SubscribeEvent public static void onEffectAdded(MobEffectEvent.Added event) { LivingEntity living = event.getEntity(); MobEffectInstance instance = event.getEffectInstance(); - if (instance == null || !ModMobEffects.SHOCK.get().equals(instance.getEffect())) { + if (instance == null || !ModMobEffects.SHOCK.get().equals(instance.getEffect().value())) { return; } @@ -107,7 +106,7 @@ public class ShockMobEffect extends MobEffect { return; } - if (instance.getEffect().equals(ModMobEffects.SHOCK.get())) { + if (instance.getEffect().equals(ModMobEffects.SHOCK)) { living.getPersistentData().remove("TargetShockAttacker"); } }