Archiviert
13
0

SPIGOT-1068: Limit the number of patterns on banners

Dieser Commit ist enthalten in:
Thinkofdeath 2015-07-23 20:50:53 +01:00
Ursprung dc40c528d7
Commit 2642f9b344
2 geänderte Dateien mit 28 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,26 @@
--- a/net/minecraft/server/TileEntityBanner.java
+++ b/net/minecraft/server/TileEntityBanner.java
@@ -20,6 +20,11 @@
if (nbttagcompound.hasKey("Patterns")) {
this.patterns = (NBTTagList) nbttagcompound.getList("Patterns", 10).clone();
+ // CraftBukkit start
+ while (this.patterns.size() > 20) {
+ this.patterns.a(20); // PAIL Rename remove
+ }
+ // CraftBukkit end
}
if (nbttagcompound.hasKeyOfType("Base", 99)) {
@@ -54,6 +59,11 @@
super.a(nbttagcompound);
this.color = nbttagcompound.getInt("Base");
this.patterns = nbttagcompound.getList("Patterns", 10);
+ // CraftBukkit start
+ while (this.patterns.size() > 20) {
+ this.patterns.a(20); // PAIL Rename remove
+ }
+ // CraftBukkit end
this.h = null;
this.i = null;
this.j = null;

Datei anzeigen

@ -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))));
}
}