Started by
Purrpy
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a special speed potion that, if you right click on a block instead of drinking it, it'll give Quick Charge 1 to any crossbow in your inventory. The thing is, I can't figure out how to target the crossbow. I tried putting a crossbow in the section for the enchantment instead of "Provided Itemstack" but it just doesn't do anything. How do you enchant a specific item instead of the item that's causing the enchanting to happen?
Edited by Purrpy on Thu, 07/29/2021 - 23:57
When you use the potion, set some variable (player persistent or entity nbt) to true. Then, make an "On player tick update procedure". Inside that, check if that variable is true and if the item in the main hand is a crossbow. If that is true, then add the enchantment to item in main hand and set variable to false.
So: the potion is used, but nothing happens yet. The player then puts a crossbow in his or her hand and BOOM it's enchanted!