Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 05:20:07 +01:00
SPIGOT-5428: Better handling of some ItemMeta
Dieser Commit ist enthalten in:
Ursprung
16dc5758ae
Commit
61d4b09023
@ -53,7 +53,12 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
|
||||
NBTTagList patterns = entityTag.getList(PATTERNS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
|
||||
for (int i = 0; i < Math.min(patterns.size(), 20); i++) {
|
||||
NBTTagCompound p = patterns.getCompound(i);
|
||||
this.patterns.add(new Pattern(DyeColor.getByWoolData((byte) p.getInt(COLOR.NBT)), PatternType.getByIdentifier(p.getString(PATTERN.NBT))));
|
||||
DyeColor color = DyeColor.getByWoolData((byte) p.getInt(COLOR.NBT));
|
||||
PatternType pattern = PatternType.getByIdentifier(p.getString(PATTERN.NBT));
|
||||
|
||||
if (color != null && pattern != null) {
|
||||
this.patterns.add(new Pattern(color, pattern));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,11 @@ class CraftMetaCharge extends CraftMetaItem implements FireworkEffectMeta {
|
||||
super(tag);
|
||||
|
||||
if (tag.hasKey(EXPLOSION.NBT)) {
|
||||
effect = CraftMetaFirework.getEffect(tag.getCompound(EXPLOSION.NBT));
|
||||
try {
|
||||
effect = CraftMetaFirework.getEffect(tag.getCompound(EXPLOSION.NBT));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Ignore invalid effects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,11 @@ class CraftMetaMap extends CraftMetaItem implements MapMeta {
|
||||
}
|
||||
|
||||
if (display.hasKey(MAP_COLOR.NBT)) {
|
||||
color = Color.fromRGB(display.getInt(MAP_COLOR.NBT));
|
||||
try {
|
||||
color = Color.fromRGB(display.getInt(MAP_COLOR.NBT));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Invalid colour
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,11 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta {
|
||||
type = CraftPotionUtil.toBukkit(tag.getString(DEFAULT_POTION.NBT));
|
||||
}
|
||||
if (tag.hasKey(POTION_COLOR.NBT)) {
|
||||
color = Color.fromRGB(tag.getInt(POTION_COLOR.NBT));
|
||||
try {
|
||||
color = Color.fromRGB(tag.getInt(POTION_COLOR.NBT));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// Invalid colour
|
||||
}
|
||||
}
|
||||
if (tag.hasKey(POTION_EFFECTS.NBT)) {
|
||||
NBTTagList list = tag.getList(POTION_EFFECTS.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren