Jump to content

[1.7.2]Pre-Enchanted Items?


drok0920

Recommended Posts

First (assuming you created your item) you need to make the ItemStack of your item. Do this

 

code start

 

registerItem(yourItem, "Your item"); //<--- normal thing

ItemStack yourItemStack= new ItemStack(YourMainClass.yourItem); //making an ItemStack
yourItemStack.addEnchantment(Enchantment.protection, 3); // adding enchantments. Do what ever you like
yourItemStack.addEnchantment(Enchantment.unbreaking, 2);
GameRegistry.addRecipe(yourItemStack, new Object[] { "###", '#', Blocks.dirt}); //adding a recipe. So when your item is crafted, it will have enchantments on it 

 

code end

 

I hope this helps :)

_         

___ ___| |__  _ __ 

/ __/ __| '_ \| '_ \

\__ \__ \ | | | | | |

|___/___/_| |_|_| |_|

Link to comment
Share on other sites

Stop over complicating things. I would use onUpdate or onCreated in your item's class. There you can use the same method and you won't have to over complicate code.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.