ke_do Posted February 25, 2024 Posted February 25, 2024 public class FireDot extends MobEffect { public FireDot() { super(MobEffectCategory.HARMFUL, 0x660990); getLogger().info("Test Log 999994 "); } @Override public void applyEffectTick(LivingEntity entity, int amplifier) { if (entity instanceof LivingEntity) { entity.hurt(entity.damageSources().inFire(), 0.1F + amplifier); getLogger().info("Test Log 22333 : ") } } public boolean isDurationEffectTick(int duration, int amplifier) { int tickInterval = 2; return duration % tickInterval == 0; } } this is my custom MobEffect public class ModEffects { public static final DeferredRegister<MobEffect> MOB_EFFECTS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, DoJiJoJu.MODID); public static final RegistryObject<MobEffect> FIRE_DOT = MOB_EFFECTS.register("fire_dot", FireDot::new); public static void register(IEventBus eventBus) {MOB_EFFECTS.register(eventBus);} } and I registed in Registry ModEffects.register(modEventBus); in my Main Class ((LivingEntity) this.target).addEffect(new MobEffectInstance(ModEffects.FIRE_DOT.get(), 100, 1)); getLogger().info("Test Log 888884 " + ModEffects.FIRE_DOT.get()); I add the Effect by this way and the `Log 888884` was printed but other Logs wasn't printed. The effect of MobEffectCategory.HARMFUL, 0x660990 was visible. but the hurt code wasn't work why It doesn't work? I tested in Creative mode and solo play Thank you Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.