Jump to content

Recommended Posts

Posted

My effect does nothing in this code

package com.sonplaying.bufffood.effects;

import javax.annotation.Nullable;

import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectType;

public class SecondWindEffect extends Effect {

	public SecondWindEffect(EffectType typeIn, int liquidColorIn) {
		super(typeIn, liquidColorIn);
	}
	
	@Override
	public void performEffect(LivingEntity a, int amplifier) {
		if (a.getHealth() < a.getMaxHealth()) {
			a.heal(1.0F);
		}
	}
	public void affectEntity(@Nullable Entity source, @Nullable Entity indirectSource, 
			LivingEntity a, int amplifier, double health) {
		this.performEffect(a, amplifier);
	    
	}
	
}

What's wrong with this?

Posted
3 minutes ago, poopoodice said:

How do you apply the effect? Have you register the effect type?

I registered the effect in my registryhandler. I put the type EffectType.BENEFICIAL...

wait, what do you mean effect type? Is it POTION_TYPE? Do i have to register that as well?

Posted
1 hour ago, poopoodice said:

Sorry I mean "effect".

Can you show us how you register it? Also 

 

i only registered

public static final RegistryObject<SecondWindEffect> SECOND_WIND_EFFECT = EFFECTS.register("second_wind_effect", () -> new SecondWindEffect(EffectType.BENEFICIAL, 152512));

 

Posted
On 8/31/2020 at 5:12 PM, diesieben07 said:

performEffect is only called if isReady returns true that tick (it returns false by default).

Yes, it works. I've put return this == REGISTRY.EFFECT_NAME.get(); and it works.

But it's different though. I've put heal, right? It's really fast for some reason. How do i slow it down? Do i just change the float value?

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.