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

I can't seem to find any tutorials or threads on how I should use attributes to add traits to players, so how would I do it? The only things on EntityPlayer related to attributes seem to be getters. I gather I should probably be using AttributeModifier somehow, but at the same time there is a whole list of IAtributes in SharedMonsterAttributes. My end goal is to use these to change the players attack speed, max health, and movement speed.

So is there any good resources I can use to figure out what I need to do?

My IGN is TheUnderTaker11, but when I tried to sign up for this site it would not send the email... So yea now I have to use this account.

If you want to modify the values of existing attributes on entities that aren't your own, use attribute modifiers. The wiki has an explanation of attributes and modifiers here.

 

If you want to store custom data on entities that aren't your own, use capabilities.

 

I have a capability that manages an attribute modifier for

SharedMonsterAttributes.MAX_HEALTH

here: API, implementation.

 

It's also used by the following classes:

  • [url=https://github.com/Choonster/TestMod3/blob/f2476600a276d8a95280078e61049b709ba90466/src/main/java/choonster/testmod3/command/CommandMaxHealthBase.java]CommandMaxHealthBase[/url]


  • [url=https://github.com/Choonster/TestMod3/blob/f2476600a276d8a95280078e61049b709ba90466/src/main/java/choonster/testmod3/command/CommandMaxHealthAdd.java]CommandMaxHealthAdd[/url]


  • [url=https://github.com/Choonster/TestMod3/blob/f2476600a276d8a95280078e61049b709ba90466/src/main/java/choonster/testmod3/command/CommandMaxHealthGet.java]CommandMaxHealthGet[/url]


  • [url=https://github.com/Choonster/TestMod3/blob/f2476600a276d8a95280078e61049b709ba90466/src/main/java/choonster/testmod3/command/CommandMaxHealthSet.java]CommandMaxHealthSet[/url]


  • [url=https://github.com/Choonster/TestMod3/blob/f2476600a276d8a95280078e61049b709ba90466/src/main/java/choonster/testmod3/block/BlockMaxHealthGetter.java]BlockMaxHealthGetter[/url]


  • [url=https://github.com/Choonster/TestMod3/blob/f2476600a276d8a95280078e61049b709ba90466/src/main/java/choonster/testmod3/block/BlockMaxHealthSetter.java]BlockMaxHealthSetter[/url]


  • [url=https://github.com/Choonster/TestMod3/blob/f2476600a276d8a95280078e61049b709ba90466/src/main/java/choonster/testmod3/item/ItemMaxHealthGetter.java]ItemMaxHealthGetter[/url]


  • [url=https://github.com/Choonster/TestMod3/blob/f2476600a276d8a95280078e61049b709ba90466/src/main/java/choonster/testmod3/item/ItemMaxHealthSetter.java]ItemMaxHealthSetter[/url]

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.

  • Author

If you want to add information to a player, use a capability, you can read up on it here: http://mcforge.readthedocs.io/en/latest/datastorage/capabilities/

Yes I have already used capabilities on players to do a different function in my mod, but I'm asking how to actually change the max health or whatever else of a player.

If you want to modify the values of existing attributes on entities that aren't your own, use attribute modifiers. The wiki has an explanation of attributes and modifiers here.

 

If you want to store custom data on entities that aren't your own, use capabilities.

 

I have a capability that manages an attribute modifier for

SharedMonsterAttributes.MAX_HEALTH

here: API, implementation.

 

It's also used by the following classes:

Wow thank you so much for the examples, that's awesome you have a whole mod just for helping people on these forums.

Also I had seen that wiki page that you linked, because I actually found a different thread where you had linked that same page before and I went to it. Although it does explain what attributes are, it doesn't really say how to use them for my purposes.

edit: Jesus the more I read through this the less I feel like I know. I'm slowing catching on though... Slowly.

My IGN is TheUnderTaker11, but when I tried to sign up for this site it would not send the email... So yea now I have to use this account.

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.