Basically, a tool is just an item that breaks certain blocks faster/deals more damage than the generic item. So, you'll want to make a new ItemUniTool (or any name) that is effective against dirt/cobble/wood/etc. For sword, I think you can do
I read through the thread, but didn't really see an answer relating to my problem... (sorry if this is old enough to be considered necro)
Basically, I've created an item, and I want that item to open up a gui (got a gui that extends GuiScreen) and a container that updates (much like a furnace), and I want to know how to "connect" an instance of the inventory to an instance of the pocket item (it's just a generic item... with nothing in it). So when I right click it, how do I say "open that specific inventory"?
I'm not exactly sure how TileEntities(that's where you'd want to save data) save all of it (TagList and all that good stuff...), but basically, Mojang made NBT as a way to save information about instances (because I think Item/Block classes are all static??)
First, you need an itemstack to access it's nbt:
itemstack.stackTagCompound = new NBTTagCompound(); //Create a new tag
Now you can save all the information you want (in relative terms):
Not sure if this is old enough to count as necro or if this is off-topic, but...
Is there a way to change the attributes of an instance of an item?
NBTTagList list = itemStack.stackTagCompound.getTagList("AttributeModifiers");
//Now what can I do with list? list.tagAt() requires an "int" for the index, and I don't know where the generic.attackDamage is?
To give a general idea, use nbt so when they respawn/login (EntityJoinWorldEvent) to load their superpower (you could have a boolean-nbt that saves whether or not it's their first time logging in. If it is (if(!player.getEntityData().hasKey("loadedPowers"))), then set their (player.getEntityData().setInt("power", rand.nextInt(24) + 1)))
The .setInt above would set the player's power to anyone of the 23 potion effects, and now you'd only have to give them that effect ("player.addPotionEffect(player.getEntityData().getInt("power", 32724);) every time they respawn/login
Now only if I knew how to use nbt-lists or nbt-arrays... :/
Woo! But what about attributes? I kind of looked around, and some people said they were final values. (Or, you'd have to "delete" and "set" a new one?)
Something like.... while it's activated that the tooltip would read:
You could use the existing materials. In the constructor, just pass Material.IRON or something else. Then I believe you can do: this.setMaxDamage(someNumber);
I would like to know how to edit attributes too!
EDIT: for damage, I think there's a method (check the ItemSword.class) called getStrVsEntity, and you can override that to provide a straight-up number (float?)
I mean like, this, to see what it says. When you put it, it should output onto your console (the thing that says like "saving," or "looking for mods in /mod folder")
0
1
Basically, a tool is just an item that breaks certain blocks faster/deals more damage than the generic item. So, you'll want to make a new ItemUniTool (or any name) that is effective against dirt/cobble/wood/etc. For sword, I think you can do
public float getStrVsEntity() {
return 5F;
}
0
0
Basically, I've created an item, and I want that item to open up a gui (got a gui that extends GuiScreen) and a container that updates (much like a furnace), and I want to know how to "connect" an instance of the inventory to an instance of the pocket item (it's just a generic item... with nothing in it). So when I right click it, how do I say "open that specific inventory"?
Code: http://pastebin.com/iDMFiisw
What is "specialFurnace.onUpdate()" doing? Don't you have to refer to an instance, or else what is it updating?
0
This might help.
0
player.addPotionEffect(new PotionEffect(PotionId, time, level));
0
1
First, you need an itemstack to access it's nbt:
Now you can save all the information you want (in relative terms):
I hope that kind of makes sense....
0
Is there a way to change the attributes of an instance of an item?
0
The .setInt above would set the player's power to anyone of the 23 potion effects, and now you'd only have to give them that effect ("player.addPotionEffect(player.getEntityData().getInt("power", 32724);) every time they respawn/login
Now only if I knew how to use nbt-lists or nbt-arrays... :/
Here's how someone used an int[] to pretty much save all the potion effects: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2120289-help-random-potion-effect-every-time-a-custom
And here's a list of potion-effect IDs: http://minecraft.gamepedia.com/Status_effect
0
Something like.... while it's activated that the tooltip would read:
"+7 speed" -> "+9 speed"?
0
I would like to know how to edit attributes too!
EDIT: for damage, I think there's a method (check the ItemSword.class) called getStrVsEntity, and you can override that to provide a straight-up number (float?)
0
Well, instead of doing this.iconArray[metadata >> 1], you should try this.iconArray[metadata - 1]
0
0