Posted February 19, 201312 yr 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)
February 20, 201312 yr 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.
February 21, 201312 yr 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.
February 22, 201312 yr Author You mean it like this: public boolean onBlockStartBreak() { if(ticks == 0) { --ItemStack.stacksize; addItemStackToInventory(new ItemStack(this, this.damage).addEnchantment(restofIt)); } }
February 22, 201312 yr 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!
February 22, 201312 yr 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.