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

Heyho Guys!

I created some armour which should give the player (or Mob) which is wearing it a health boost. The problem is: If I use the potion Effect to manage this, the extra hearts never regenerate because they are resetted if I re-apply the potion effect every Tick. How can I fix this issue to create an armour that increases your maximum health?

Hey Bedrock_Miner,

 

you told that the regen effect doesnt apply fast enough because it gets reseted every tick.

 

The solution?

In your onArmorUpdate() method make a int-variable that counts ticks. Make it increase on every tick by 1 and

when it hits lets say 200 (10 secs) then you reapply the regen-effect. Then reset the counter again to 0.

 

 

 

Just give the entity a regeneration effect level 5000. That would easily fill the hearts up it only has to be there for maybe 10 ticks or so

Get the entitys current health before you reapply the effect, and set the health to it afterward.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • 2 weeks later...

Try this.  check if potion is active, if no then add else combine.

 

if (!player.isPotionActive(potion.id))

    player.addPotionEffect(new PotionEffect(potion.id, duration, amplifier, isAmbient));

else {

    PotionEffect potionEffect = player.getActivePotionEffect(potion);

    if (potionEffect.getDuration() < duration)

        potionEffect.combine(new PotionEffect(potion.id, duration, amplifier, isAmbient));

    }

}

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.