Posted September 21, 201312 yr So i was wondering how to add a kill counter to a tool anyone have any ideas? I just want it so that when you hover the cursor over it, it will show how many kills the sword has
September 21, 201312 yr The best way, in my opinion, is to: 1. Make an NBT tag for the kills to be stored in 2. Detect when the tool successfully kills the mob and add to the NBT tag 3. Use the addInformation method to display the kills Kain
September 21, 201312 yr Author to create a new tag i would go to net.minecraft.nbt and create a new tag?
September 21, 201312 yr Umm, not really. Check out this link to see how to use NBT Tags: http://www.minecraftforge.net/wiki/Item_nbt Kain
September 21, 201312 yr Author when I use the addInformation NBT where would I put it in my code? Anywhere?
September 21, 201312 yr addInformation is a method belonging to the Item class, so you need to implement/override it in your custom Item class. In the method, you will need to check if the Item NBT tag is null and if so, create a new tag first, otherwise you will crash your game when you mouse over your Item in the Creative Tab. http://i.imgur.com/NdrFdld.png[/img]
September 22, 201312 yr Author Here Is A Screenshot of the code I have for the word that I want to have the kill counter. can either of you tell me what else I should do?
September 22, 201312 yr Your UltimateGemSword class should look more like this: package yourpackage.examplemod import net.minecraft.everything.*; public class UltimateGemSword extends ItemSword { public UltimateGemSword(yourparams) { super(par1, par2Material); } @Override public void doStuff() { //example stuff } public void addInformation() { //example stuff } } To my knowledge, I don't think you should be placing methods inside of other methods. Kain
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.