调整mob effect
This commit is contained in:
parent
6cb0c223f2
commit
1415430079
1 changed files with 15 additions and 14 deletions
|
@ -17,8 +17,10 @@ import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.neoforge.event.entity.living.MobEffectEvent;
|
import net.neoforged.neoforge.event.entity.living.MobEffectEvent;
|
||||||
|
import net.neoforged.neoforge.event.tick.EntityTickEvent;
|
||||||
import net.neoforged.neoforge.network.PacketDistributor;
|
import net.neoforged.neoforge.network.PacketDistributor;
|
||||||
|
|
||||||
|
// TODO 解决加上效果就立刻消失的问题
|
||||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME)
|
@EventBusSubscriber(bus = EventBusSubscriber.Bus.GAME)
|
||||||
public class BurnMobEffect extends MobEffect {
|
public class BurnMobEffect extends MobEffect {
|
||||||
|
|
||||||
|
@ -99,18 +101,17 @@ public class BurnMobEffect extends MobEffect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO tick event?
|
@SubscribeEvent
|
||||||
// @SubscribeEvent
|
public static void onLivingTick(EntityTickEvent.Post event) {
|
||||||
// public static void onLivingTick(EntityTickEvent event) {
|
var entity = event.getEntity();
|
||||||
// var entity = event.getEntity();
|
if (!(entity instanceof LivingEntity living)) return;
|
||||||
// if (!(entity instanceof LivingEntity living)) return;
|
|
||||||
//
|
if (living.hasEffect(ModMobEffects.BURN)) {
|
||||||
// if (living.hasEffect(ModMobEffects.BURN)) {
|
living.setRemainingFireTicks(2);
|
||||||
// living.setRemainingFireTicks(2);
|
}
|
||||||
// }
|
|
||||||
//
|
if (living.isInWater()) {
|
||||||
// if (living.isInWater()) {
|
living.removeEffect(ModMobEffects.BURN);
|
||||||
// living.removeEffect(ModMobEffects.BURN);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue