Jump to content

Recommended Posts

Posted
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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.