GlowstoneMC / Glowstone-Legacy

An open-source server for the Bukkit Minecraft modding interface
Other
363 stars 122 forks source link

Add Potion ItemMeta #553

Closed ZephireNZ closed 8 years ago

ZephireNZ commented 9 years ago

This adds implementation for PotionMeta. Requires GlowstoneMC/Glowkit#58 for the new ShowParticles NBT metadata.

PotionMeta is used on potions to replace the effect potion, and/or add more that one effect to the potion.

dequis commented 9 years ago

Referencing #77

turt2live commented 9 years ago

@ZephireNZ How does this hold up against old worlds/files? Such as a server "upgrading" from 1.7.10 where ShowParticles doesn't exist. Would plugin data be restored (items in YAML files) correctly as well as player inventories/effects?

ZephireNZ commented 9 years ago

Sorry for the late reply. Currently the PR just has defaults for non-required parts, if it doesn't exist in NBT:

PotionEffectType type = PotionEffectType.getById(tag.getByte("Id"));
int duration = tag.getInt("Duration");
int amplifier = tag.getByte("Amplifier");
boolean ambient = tag.isByte("Ambient") ? tag.getBool("Ambient") : false;
boolean particles = tag.isByte("ShowParticles") ? tag.getBool("ShowParticles") : true;