mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-19 07:33:11 +01:00
SPIGOT-1068: Limit the number of patterns on banners
This commit is contained in:
parent
dc40c528d7
commit
2642f9b344
2 changed files with 28 additions and 2 deletions
26
nms-patches/TileEntityBanner.patch
Normal file
26
nms-patches/TileEntityBanner.patch
Normal file
|
@ -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;
|
|
@ -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))));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue