SPIGOT-4217: Account for ShowIcon to allow custom tipped arrows to merge

This commit is contained in:
md_5 2018-08-03 19:57:09 +10:00
parent 69970127c1
commit 9331153551

View File

@ -31,6 +31,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
static final ItemMetaKey AMBIENT = new ItemMetaKey("Ambient", "ambient");
static final ItemMetaKey DURATION = new ItemMetaKey("Duration", "duration");
static final ItemMetaKey SHOW_PARTICLES = new ItemMetaKey("ShowParticles", "has-particles");
static final ItemMetaKey SHOW_ICON = new ItemMetaKey("ShowIcon", "has-icon");
static final ItemMetaKey POTION_EFFECTS = new ItemMetaKey("CustomPotionEffects", "custom-effects");
static final ItemMetaKey POTION_COLOR = new ItemMetaKey("CustomPotionColor", "custom-color");
static final ItemMetaKey ID = new ItemMetaKey("Id", "potion-id");
@ -80,7 +81,8 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
int duration = effect.getInt(DURATION.NBT);
boolean ambient = effect.getBoolean(AMBIENT.NBT);
boolean particles = effect.getBoolean(SHOW_PARTICLES.NBT);
customEffects.add(new PotionEffect(type, duration, amp, ambient, particles));
boolean icon = tag.hasKeyOfType(SHOW_ICON.NBT, CraftMagicNumbers.NBT.TAG_BYTE) ? effect.getBoolean(SHOW_ICON.NBT) : particles;
customEffects.add(new PotionEffect(type, duration, amp, ambient, particles, icon));
}
}
}
@ -128,6 +130,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
effectData.setInt(DURATION.NBT, effect.getDuration());
effectData.setBoolean(AMBIENT.NBT, effect.isAmbient());
effectData.setBoolean(SHOW_PARTICLES.NBT, effect.hasParticles());
effectData.setBoolean(SHOW_ICON.NBT, effect.hasIcon());
effectList.add(effectData);
}
}