1
I am making a datapack where everything is invisible, and I want to add a splash potion of glowing so that you can have a boost. I don't know how to add the potion though. Do I have to use a loot table, functions, or something else. Also I want it to be a thing you can keep getting throughout gameplay.
Create an account or sign in to comment.
4
2
This command gives you a splash potion of glowing (you can alter it as you like):
CustomPotionColor is the potion color in RGB translated to decimal (try this website). I used #c7b24c, which is a type of yellow.
give @s minecraft:splash_potion{CustomPotionEffects: [{Id: 24b, Duration: 100}], CustomPotionColor: 13087308}
Duration is the duration in ticks (5 seconds in the command above).CustomPotionColor is the potion color in RGB translated to decimal (try this website). I used #c7b24c, which is a type of yellow.
1
An entity & item tagging function would be used here along with scoreboards. How it works is like this:
Let's say you have a splash potion with no effects and an item tag of "GlowPotion". A function detects everyone holding the "GlowPotion" in their hand slot and adds the tag "HoldingGlowPotion" to the player, and removes it when not. (I forgot if potions are usable in the off-hand slot, but if they are, an off-hand slot detection may be needed here as well)
Meanwhile, a scoreboard that detects players using a splash potion is active, but instead of detecting all types of potions, it only detects players who have the tag "HoldingGlowPotion", which is only present if you're holding the "GlowPotion". So, if you use that potion, you'll get 1 point in the scoreboard.
Then, another function gives the glowing effect to everyone who has the score of 1 in the scoreboard and the tag "HoldingGlowPotion", then promptly removes your score and tag so it can be used once again and the function executed only once.
Let's say you have a splash potion with no effects and an item tag of "GlowPotion". A function detects everyone holding the "GlowPotion" in their hand slot and adds the tag "HoldingGlowPotion" to the player, and removes it when not. (I forgot if potions are usable in the off-hand slot, but if they are, an off-hand slot detection may be needed here as well)
Meanwhile, a scoreboard that detects players using a splash potion is active, but instead of detecting all types of potions, it only detects players who have the tag "HoldingGlowPotion", which is only present if you're holding the "GlowPotion". So, if you use that potion, you'll get 1 point in the scoreboard.
Then, another function gives the glowing effect to everyone who has the score of 1 in the scoreboard and the tag "HoldingGlowPotion", then promptly removes your score and tag so it can be used once again and the function executed only once.
2
The options I know of:
- Use recipes: make it give a knowledge book and replace it with the potion based on an advancement, see here
- Use loot tables: replace vanilla minecraft loot tables to make it appear in world generation chests
- Use functions: Create a function that detects items on the ground and kills them + summons potion.
- Use functions: Use a scoreboard objective to create a timer and automatically give players the potion every now and then.
1
[deleted]