Jump to content

Recommended Posts

Posted (edited)

Hey all, I'm sure I missed something simple, but I'm trying to create a a custom potion that acts like multiple Vanilla potions combined together. In this example, I'm trying to create a potion that acts like a Slowness, Mining Fatigue, and Health Boost potion all in one.

 

The Slowness and Health Boost attributes get modified correctly when the effect is given to the player, however, the Mining Fatigue attribute seems to remain unchanged, and I cannot figure out why. Any and all help is appreciated. Many thanks!

 

public class PotionExample extends Potion {
    public PotionExample(boolean isBadEffect, int liquidColor){
        super(isBadEffect, liquidColor);
        this.registerPotionAttributeModifier(SharedMonsterAttributes.ATTACK_SPEED, MathHelper.getRandomUUID().toString(), -3.0D, 2);
        this.registerPotionAttributeModifier(SharedMonsterAttributes.MOVEMENT_SPEED, MathHelper.getRandomUUID().toString(), -0.5D, 2);
        this.registerPotionAttributeModifier(SharedMonsterAttributes.MAX_HEALTH, MathHelper.getRandomUUID().toString(), 4.0D, 0);
    }
  
  	@Override
    public void performEffect(EntityLivingBase entityLivingBase, int amplifier) {
        super.performEffect(entityLivingBase, amplifier);
    }

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

 

Edited by IronIngotGuy
Posted
5 hours ago, diesieben07 said:

I suspect your modifier is just too large, try using a smaller number (or rather bigger, since it's negative) than -3. Vanilla uses -0.1 for mining fatigue.

Also, do not generate a new UUID every time. Pick one UUID and stick to it, like vanilla does.

Thank you! After making those tweaks, the hand animation seems to have changed fine. However, it seems like the dig speed has been unchanged. It looks like the EntityPlayer class's dig speed is hardcoded around the Haste and Mining Fatigue Potions specifically. Is there a way around this to mimic Mining Fatigue's digging speed changes on the player?

Thanks again

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.