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 want to make like a sword that steals power from what you kill.

 

Example:

You kill an entity you gain 1 stack.

You can have a max of 1000 stacks (100 bonus damage)

 

I probably have to use IExtendedEntityProperties and/or NBT.

So any ideas where I should start, and any suggestions?

 

Thanks.

 

-I have basic Java knowledge, and Minecraft modding knowledge-

I would use NBT tags to store the kill count, then use the addInformation method to display how many kills the weapon has on the tooltip.

 

Additionally, you could store who crafted it in the NBT compound and only apply the kill count bonus for that player.

  • Author

Still kinda confused.

How would I set up a NBT tag to store the integer and the player name (String)?

As diesieben7 said, every item will have a NBTTagCompound assigned to it. You can read and write values using a sort of name/value pair system (bad explaination on my part, I haven't really used them much). So you could set the kill count using tagComp.getInt("killCount") to get the current one, incrementing it, then using tagComp.setInt("killCount", newValue) to add the new count. You will need more than those two functions, but that's pretty much the basics of reading and writing to a tag compound.

  • Author

-- I know how to use NBT, now (that's out of the way) --

 

I don't know how to apply let's say a new integer named "kills" and store it to something.

I don't know how to get that "something" because I want it for each individual player as well.

Maybe I'm over thinking this, if anyone can help me solve this, it will be great c:

The item's NBT is stored for that instance of the item, if you want it to be a stat that will stay even if the player looses their sword and makes a new one, you'll need an extendedplayer. There are a few tutorials on how to do that, they basically store an NBT to the player that will persist through relog, and if you want it to, player death

Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more!

width=174 height=100http://i.imgur.com/ghgWmA3.jpg[/img]

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.