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

Hi! I was trying to  reate a custom effect, and it works properly except for a little thing.

When im on the Inventory of the Player, it doesn't render at all, how can i do?
image.thumb.png.d476e6da8e7d9d10d294ae762b355fe4.png
I see that there is a method called "renderHUDEffect(...)", but i don't know how to use it.
Someone can help me?

This is my Effect Class:

public class ColorEffect extends Effect {

    private final String colorName;
    private final String descriptionId;

    public ColorEffect(String colorName, int color) {
        super(EffectType.HARMFUL, color);
        this.colorName = colorName;
        this.descriptionId = "color.effect." + colorName;
    }

    @Override
    public void applyEffectTick(LivingEntity entity, int amplifier) {
        if (entity instanceof PlayerEntity) {
            PlayerEntity player = (PlayerEntity) entity;
            if (amplifier <= 0) {
                player.removeEffect(this);
                return;
            }
            player.causeFoodExhaustion(0.5f);
            player.addEffect(new EffectInstance(this, 2000, amplifier));
        }
    }

    @Override
    public boolean isDurationEffectTick(int duration, int amplifier) {
        return true;
    }

    public String getColorName() {
        return colorName;
    }

    @Override
    public ITextComponent getDisplayName() {
        return new TranslationTextComponent("colorfood.effect." + this.colorName);
    }

    public String getOrCreateDescriptionId() {
        return this.descriptionId;
    }
}

Thanks!

  • Author

Oh, I need to register the Effect?
Not finding the EFFECT tag in ForgeRegistries I thought I shouldn't register them. How can I register an effect?

8 minutes ago, Yurim64 said:

Oh, I need to register the Effect?
Not finding the EFFECT tag in ForgeRegistries I thought I shouldn't register them. How can I register an effect?

DeferredRegisty
ForgeRegistries#POTIONS for an effect, ForgeRegistries#POTION_TYPES -> for a potion

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.