Posted May 25, 201411 yr 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-
May 25, 201411 yr I would use a NBT compound for storing the kill count, a good tutorial for those is right here: http://www.minecraftforge.net/wiki/How_to_use_NBT_Tag_Compound Creator of Metroid Cubed! Power Suits, Beams, Hypermode and more! http://i.imgur.com/ghgWmA3.jpg[/img]
May 25, 201411 yr 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.
May 25, 201411 yr Author Still kinda confused. How would I set up a NBT tag to store the integer and the player name (String)?
May 25, 201411 yr 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.
May 26, 201411 yr 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:
May 26, 201411 yr 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! http://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.