Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.