Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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)

  • Author

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.

 

idk the best way, but u can get the current tool damage and others enchantaments(if u want to remove just one of then) and then u delete, and give the same tool, set the damage to the same before and the other enchantaments.

  • Author

You mean it like this:

 

public boolean onBlockStartBreak()

{

    if(ticks == 0)

    {

        --ItemStack.stacksize;

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

    }

}

  • Author

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!

so get the current itemstack nbttaglist(only enchantaments use this), check to see if is not null and contains the enchantament ids that u want, and then remove. take a look at itemstack and enchantament helper

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.