Topic category: Help with modding (Java Edition)
Hey, so I'm making an armor leggings that basically when you put them on it gives you a sword. Problem is, I didn't think about the fact if you drop the sword it directly gives you another sword and you can get back the sword you dropped and by that you can duplicate it. The procedure that I made is basically when the player as the leggings, if he does not have a sword, give him a sword. It's the only way I found to prevent from having infinite swords spawning in the player's inventory. Is there any way to prevent that duplication by maybe making the sword unable to be dropped ?
Actually, you can also duplicate it by putting the sword in a chest or basically by taking it off the inventory so prevent the sword from being dropped is useless. I thought maybe I can do a procedure that detects when there's more than 1 sword in the player's inventory and if so it deletes the amount of sword so that there's only one left, but I didn't see anything that can count the amount of a certain item in the inventory so... :/ need help idk what to do
Any help is really appreciated !