Posted December 19, 20159 yr I'd like my code to be able to apply potion effects added by other mods, but the IDs of those potion effects aren't necessarily static (certain mods allow you to change the potion IDs via a config file). So instead of doing something like: entityPlayer.addPotionEffect(new PotionEffect(48, 200)); I'd prefer to do something like: entityPlayer.addPotionEffect(new PotionEffect("witchery:potion.insane", 200)); But I'm not sure how to get the corresponding integer ids from the unlocalized names of the potions.
December 19, 20159 yr Iterate through Potion.potionTypes until you find a Potion that returns the specified name from Potion#getName . You'll probably want to do this once at startup rather than every time you apply the effect. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.