SPIGOT-1068: Limit the number of patterns on banners

This commit is contained in:
Thinkofdeath committed 2015-07-23 20:50:53 +01:00
1 parent dc40c528d7
commit 2642f9b344
2 files changed
+28 -2

No files matched your search

@@ -50,8 +50,8 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta {
if (entityTag.hasKey(PATTERNS.NBT)) {
NBTTagList patterns = entityTag.getList(PATTERNS.NBT, 10);
for (int i = 0; i < patterns.size(); i++) {
NBTTagCompound p = (NBTTagCompound) patterns.get(i);
for (int i = 0; i < Math.min(patterns.size(), 20); i++) {
NBTTagCompound p = patterns.get(i);
this.patterns.add(new Pattern(DyeColor.getByDyeData((byte) p.getInt(COLOR.NBT)), PatternType.getByIdentifier(p.getString(PATTERN.NBT))));
}
}