Adding enchantments to items

Upvotes: 0
Issue description

Hi, I wanted to ask if it's possible to add a procedure block which enchants a tool/armour/weapon/book.

This looks interesting:

 // assuming you have the ItemStack passed in from the method parameters, otherwise create one
// ItemStack stack = new ItemStack(whateverSwordItemHere);
stack.addEnchantment(Enchantment.fireAspect, 2);

I got this from there:

https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/…

 

The forum is a bit older but can this work? Doesn't look like a lot code.

Issue comments

So that I could get a item from a inventory or blocks inventory and enchant a item in slot x with xxx.

You can already enchant passed itemstacks via dependency. We do plan to add option to use items from slots as itemstack dependencies in the future updates too.

And how can I already do that? What even does this block "make a copy of provided itemstack" do. If you would add some little explanations if you hover over a block in the block selection would be great.



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.