I made swords with modloader, and now I want to add enchantments to them. How do i do this? Is there a command like .addEnchantment? I know there is enchantment.(fireaspect, etc.) but I don't know how to do this.
Sorry, but the code doesn't work for me. I'm not sure where to add this.
I've tried placing this in mod_whatever.java , but it doesn't work, it says its undefined for the type item.
(i put ItemSword, not Item)
do I have to make a seperate ItemWhatever.java?
Sorry, but the code doesn't work for me. I'm not sure where to add this.
I've tried placing this in mod_whatever.java , but it doesn't work, it says its undefined for the type item.
(i put ItemSword, not Item)
do I have to make a seperate ItemWhatever.java?
He said its psudocode (i.e. not real code, just enough to get the message across). Another version could be written as
Create itemStack object containing the item you want
Add enchantemnet of choice to the itemStack
Create recipie as normal using the itemStack as the 1st argument
You would put your version, doing the same steps where you would normally create your recipie
Is there a way to add it to the crafting recipe or something because I want to make an ore or something that you can attach onto the tool and it'll add an enchantment.
The said method onCreated, is a recipe bound auto-enchant. HOWEVER!!!! These items MUST be crafted to gain the enchant(s). Using cheat methods suchs as, commands, creative mod, ect. will yield the item WITHOUT enchants.
Yeah, Ryandacod6, elaborate a bit.
Read closely
This is not the right names for everything but you get the idea from it. A.K.A. this is pseudocode.
I've tried placing this in mod_whatever.java , but it doesn't work, it says its undefined for the type item.
(i put ItemSword, not Item)
do I have to make a seperate ItemWhatever.java?
He said its psudocode (i.e. not real code, just enough to get the message across). Another version could be written as
You would put your version, doing the same steps where you would normally create your recipie
WAIT! I found where it is! It's in ItemStack, not Item!
itemStack.addEnchantment(Enchantment, int)
Enchantment is the type and the int is what level of enchantment
Try this code:
It worked for me, BUT TAKE NOTE: This will only work if the item came from a furnace or crafting table
Edit: Put this in your ItemName.java file.
Click the picture!
-Derek Shunia
:3
That is what people get for cheating