Potions with Custom Effects

In Pycraft, I figured out the Potions-with-custom-effects, the problem being that Bukkit's PotionEffectType doesn't actually implement the keyed interface, but instead has its own .values() call, so needs a whole special handler. The code for creating potion with custom effects looks like:


await potion_of(
'night_vision',
"Gopher's Gruel",
{
'type': 'fast_digging',
'duration': 20 * 60 * 8, # in ticks, so 20 seconds...
'amplifier': 50, # likely excessive
},
{
'type': 'luck',
'duration': 20 * 60 * 8, # in ticks, so 20 seconds...
'amplifier': 1,
},
player=player,
world=world,
)

Custom effects are converted from the dictionaries to the PotionEffect type and the python code for potion_of just adds each of them in turn using addCustomEffect() for the PotionMeta.

Comments

Comments are closed.

Pingbacks

Pingbacks are closed.