Help with Potion ID?
ShugarCubez opened this issue ยท 5 comments
I'm trying to make a Trade with a villager but for some reason the game isn't recognising your potion ID, Am I doing something wrong? Or what is the proper ID for your Potion effect?
_{rewardExp:1b,maxUses:2147483647,buy:{id:"minecraft:dragon_breath",Count:16b},sell:{id:"minecraft:potion",Count:2b,tag:{display:{Name:'{"text":"Potion of Extreme Fortune","color":"light_purple","italic":false}',Lore:['{"text":"Extra Fortune gains, Can see Emerald and Diamonds Clearly while mining"}']},CustomPotionEffects:
[{Id:potionsmaster.diamondpotioneffect,Amplifier:2b,Duration:6000,ShowParticles:0b},{Id:potionsmaster.emeraldpotioneffect,Amplifier:2b,Duration:6000,ShowParticles:0b},_
{Id:mysticalworld.serendipity,Amplifier:2b,Duration:6000,ShowParticles:0b}]
,CustomPotionColor:2752375}}}]}}} 1
The BOLD is your potion effect that I am trying to do and I've tried the following
{mysticalworld:serendipity,Amplifier:2b,Duration:6000,ShowParticles:0b}]
{Id:mysticalworld.serendipity,Amplifier:2b,Duration:6000,ShowParticles:0b}]
{serendipity,Amplifier:2b,Duration:6000,ShowParticles:0b}]
{Id:mysticalworld:serendipity,Amplifier:2b,Duration:6000,ShowParticles:0b}]
Is there a specific name that I need to put for command blocks to register the proper Effect?
I think the potion id is specifically a string, so try "mysticalworld:serendipity"?
I think the potion id is specifically a string, so try "mysticalworld:serendipity"?
As stated above, I've already tried that
mysticalworld:serendipity,Amplifier:2b,Duration:6000,ShowParticles:0b}]
public static final RegistryEntry<SupplierPotion> SERENDIPITY_POTION = MysticalWorld.REGISTRATE.simple("serendipity", Potion.class, () -> new SupplierPotion(() -> new EffectInstance(ModEffects.SERENDIPITY.get(), 2 * 20 * 60, 2)));
This is how it's registered, with Registrate converting it to "mysticalworld:serendipity". But, you're using CustomPotionEffects, which I didn't notice earlier, and I believe those are handled differently and depend on the world, which is something completely out of my control.
As regards Id:potionsmaster.diamondpotioneffect
, I'm confused as that would literally appear to be a string and I'm not sure how that would be parsed by Minecraft. You may want to dig deeper into how CustomPotionEffects are constructed.
They're parsed by Minecraft as follows:
public static EffectInstance read(CompoundNBT nbt) {
int i = nbt.getByte("Id") & 0xFF;
Effect effect = Effect.get(i);
return effect == null ? null : readInternal(effect, nbt);
}
In this instance, it seems to be expecting a numeric id rather than a string. The numeric id for potions depends entirely on the loading order of mods (when the world was first created) specifically for that world. There's literally no way for me to know that id, unfortunately.
It also depends on what other mods you have installed that add potions. You would have to look it up inside that specific world instance inside the game. CraftTweaker previously had a number of dump commands that dumped the registries (including their names and IDs), but that may not be available in 1.16 or it might not reflect the actual state of the world.
It also has the /ct hand
command which prints out (and copies to your clipboard) a copy of whatever potion is in your hand. I don't know if that would help with the pre-created potion as, it not being a custom effect, is most likely using the string id.
Failing that, another alternative may be to use something like NBTExplorer to open the level.dat
for your saved world, find the relevant effects registry ("mob_effect" is what it's called, I believe), and then look through each entry (which will be a pair of a number and a string) until you find serendipity.
You may have better luck asking on Minecraft-specific forums or Discords, etc, on how to find potion ids for modded potions for use in CustomPotionEffects, if none of the above help.
Otherwise, there's not really much else I can do to help you, sorry.
public static final RegistryEntry<SupplierPotion> SERENDIPITY_POTION = MysticalWorld.REGISTRATE.simple("serendipity", Potion.class, () -> new SupplierPotion(() -> new EffectInstance(ModEffects.SERENDIPITY.get(), 2 * 20 * 60, 2)));This is how it's registered, with Registrate converting it to "mysticalworld:serendipity". But, you're using CustomPotionEffects, which I didn't notice earlier, and I believe those are handled differently and depend on the world, which is something completely out of my control.
As regards
Id:potionsmaster.diamondpotioneffect
, I'm confused as that would literally appear to be a string and I'm not sure how that would be parsed by Minecraft. You may want to dig deeper into how CustomPotionEffects are constructed.They're parsed by Minecraft as follows:
public static EffectInstance read(CompoundNBT nbt) { int i = nbt.getByte("Id") & 0xFF; Effect effect = Effect.get(i); return effect == null ? null : readInternal(effect, nbt); }In this instance, it seems to be expecting a numeric id rather than a string. The numeric id for potions depends entirely on the loading order of mods (when the world was first created) specifically for that world. There's literally no way for me to know that id, unfortunately.
It also depends on what other mods you have installed that add potions. You would have to look it up inside that specific world instance inside the game. CraftTweaker previously had a number of dump commands that dumped the registries (including their names and IDs), but that may not be available in 1.16 or it might not reflect the actual state of the world.
It also has the
/ct hand
command which prints out (and copies to your clipboard) a copy of whatever potion is in your hand. I don't know if that would help with the pre-created potion as, it not being a custom effect, is most likely using the string id.Failing that, another alternative may be to use something like NBTExplorer to open the
level.dat
for your saved world, find the relevant effects registry ("mob_effect" is what it's called, I believe), and then look through each entry (which will be a pair of a number and a string) until you find serendipity.You may have better luck asking on Minecraft-specific forums or Discords, etc, on how to find potion ids for modded potions for use in CustomPotionEffects, if none of the above help.
Otherwise, there's not really much else I can do to help you, sorry.
Thank you so much for the help, I figured out my problem with your help, I was able to successfully make a custom potion with Villager trades,
Basically Minecraft uses Numeric ID to determine the potions like you said above, So it made me think "So if he says it depends on the loading order of the world doesn't that mean the potions will go in order depending on the number assigned starting from 32 being the last vanilla potion?
So As I tested, My world loaded the Potion ID for the following
Diamond Sight: 53
Emerald Sight: 54
Starting from 48 to 71 Is all of your NON-SPLASH / NON-LINGERING Potion ID's for your Mod. :)
From what I tested it doesn't matter about the world loading, Just rather how your CurseForge loads your mods :)
From what I tested it doesn't matter about the world loading, Just rather how your CurseForge loads your mods :)
In theory, yes, but if you remove a mod from a pre-existing world or add a mod to a pre-existing world then there is the potential for mismatch. Ideally with a modpack this would never happen, but it's certainly something to be aware of if you're still a work in progress -- always test in a fresh world instance to make sure that they line up properly. I fell prey to this a lot in my early attempts in 1.12, where the issue was compounded with enchantments also functioning like this.