1

Help With Adding a Custom Potion to Minecraft

Flashbulb's Avatar Flashbulb3/13/21 7:01 am
1 emeralds 305 4
3/17/2021 10:50 am
One_Nose's Avatar One_Nose
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.
Posted by Flashbulb's Avatar
Flashbulb
Level 47 : Master Fish
85

Create an account or sign in to comment.

4

2
03/17/2021 10:50 am
Level 57 : Grandmaster Hero
One_Nose
One_Nose's Avatar
This command gives you a splash potion of glowing (you can alter it as you like):
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
03/17/2021 2:11 am
Level 5 : Apprentice Artist
RocketPlays
RocketPlays's Avatar
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.
2
03/13/2021 8:21 am
Level 70 : Legendary Engineer
Bertiecrafter
Bertiecrafter's Avatar
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
03/13/2021 8:26 am
Level 13 : Journeyman Miner
anonpmc2747568
anonpmc2747568's Avatar
[deleted]
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome