Posted June 11, 20214 yr 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? 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!
June 11, 20214 yr 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?
June 11, 20214 yr 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.