Jump to content

How to remove enchantments from items?


Moritz

Recommended Posts

Hello.

 

My mod Dynamic Tools uses the basic Enchantments but i want to make them Time/Uses Based.

 

This means they are Holding only a view Uses/Ticks and then the remove itself.

 

I want to use the function onBlockStartBreak for this.

 

but i have no clue how to remove them when you are using the item. I know i have to read the list and then delete them! But i do not know how to do this.

 

How can i remove enchantments from items? (Lists or 1 By 1)

Link to comment
Share on other sites

I did override the text.

I did not mean delete enchantments from the game.

 

I only want to know how to delete them from a item like this:

 

int enchantedTime = 500;

boolean isEnchanted = true;

 

if(!entchantedtime > 0 && isEnchanted)

{

    removeEnchantments();

    removeEnchantment(Enchantment.SilkTouch, 3())

}

 

this is what i want to do.

 

Link to comment
Share on other sites

You mean it like this:

 

public boolean onBlockStartBreak()

{

    if(ticks == 0)

    {

        --ItemStack.stacksize;

        addItemStackToInventory(new ItemStack(this, this.damage).addEnchantment(restofIt));

    }

}

 

 

But i do not want to make for every tool a class. I want a itemtoolclass for every basic tool.

 

There is a way to remove a list. Or something inside of the list.

So there could be a way to remove enchantment!

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.