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

A little question but I dont find a solution: How can I set the max Health of a Player, e.g. that the player only has 5 hearts

You need to apply an attribute modifier to the player.

 

When I did this in my mod, I created a capability to manage the modifier. You can see the API here and the implementation here.

 

Is there a more simple way of doing it?

I still haven't published a mod because I can never get that in-dev version just right to warrant a public release. And yes, after two years of mod development I am still learning to speak Java.

 

Follow me on GitHub: https://github.com/yooksi

Contact me on Twitter: https://twitter.com/yooksi

Read my Minecraft blog: https://yooksidoesminecraft.blogspot.de/

You need to apply an attribute modifier to the player.

 

When I did this in my mod, I created a capability to manage the modifier. You can see the API here and the implementation here.

 

Is there a more simple way of doing it?

 

It depends on what your needs are.

 

When does the player's maximum health need to change? How often does it need to change? Are there existing systems (e.g. potions, equipment) that will apply the modifier when you need it?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

It depends on what your needs are.

 

When does the player's maximum health need to change? How often does it need to change? Are there existing systems (e.g. potions, equipment) that will apply the modifier when you need it?

Can you explain that a bit more? If you would want for the players health to not exceed 5 hearts for example I thought you only need to change it once when the player enters the world.

I still haven't published a mod because I can never get that in-dev version just right to warrant a public release. And yes, after two years of mod development I am still learning to speak Java.

 

Follow me on GitHub: https://github.com/yooksi

Contact me on Twitter: https://twitter.com/yooksi

Read my Minecraft blog: https://yooksidoesminecraft.blogspot.de/

It depends on what your needs are.

 

When does the player's maximum health need to change? How often does it need to change? Are there existing systems (e.g. potions, equipment) that will apply the modifier when you need it?

Can you explain that a bit more? If you would want for the players health to not exceed 5 hearts for example I thought you only need to change it once when the player enters the world.

 

You could apply the modifier once when the player enters the world, but that will be a static reduction and won't account for other modifiers being added or removed.

 

If you want to change the modifier's amount, you need to handle removing it, re-calculating the reduction, making sure the max health doesn't reach 0 and re-applying it.

 

I chose to do this with a capability.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.