Started by
ShiggyP
on
Topic category: Help with MCreator software
I have been attempting failing miserably to create a system in which when a player hold an item it would add +1 sharpness to that item and when it is not in their main hand it reverts to its original level of sharpness including 0. Does anybody know any workarounds or plugins for the most recent mcreator version on 1.21.1.
i think you would have to set up an 'on player tick update' procedure that scans the players inventory, adding a level of sharpness to the item if held, and then removing sharpness when it is no longer held and adding back the original level after the fact.
I basically have what you said down to enchanting in hand working its the disenchanting and the retaining that's the problem
https://postimg.cc/7CHY7TD4
if item is enchantable will not work on items that are already enchanted i believe,
also when you're adding and removing enchantments from an itemstack variable it will only effect the stored variable data, not the actual item that the variable is based on
i think it would be better to do item stack iterator, there's a block that lets you run as item stack iterator for every item in a player's inventory. If the itemstack iterator is enchantable or enchanted and item stack iterator = item held in main hand then you add one level, and give it an nbt true/false tag set to true. then for every itemstack iterator that isn't in your mainhand and has that nbt tag set to true, set it to false and remove 1 level of the enchant
oh ok thank you ill try that