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

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?

  • Author
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?

Sorry I mean "effect".

Can you show us how you register it? Also 

Quote

How do you apply the effect?

 

Edited by poopoodice

  • Author
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));

 

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

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.