Update Paper

This commit is contained in:
2024-02-10 19:15:15 -06:00
parent f00572a121
commit e7b13dc764
9 changed files with 40 additions and 40 deletions

View File

@ -5,13 +5,13 @@ Subject: [PATCH] Add depth limit to SNBT
diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java
index 5bec54239a2b185284c10d58854e5a13e33daae5..f112d82b0a9e5513395fa7c1b05d1fe9e28c64ca 100644
index 9ecd0b7ddaa8376f3c1448f810f7757c9ba1b90a..817f7f8400122da9881adcf530f379bfb69910d8 100644
--- a/src/main/java/net/minecraft/nbt/TagParser.java
+++ b/src/main/java/net/minecraft/nbt/TagParser.java
@@ -179,9 +179,56 @@ public class TagParser {
}
@@ -182,9 +182,56 @@ public class TagParser {
this.expect('}');
this.depth--; // Paper
- return compoundTag;
+ return exceedsDepthLimit(compoundTag) ? new CompoundTag() : compoundTag; // Scissors - Add depth limit to SNBT
}
@ -66,16 +66,16 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..f112d82b0a9e5513395fa7c1b05d1fe9
private Tag readListTag() throws CommandSyntaxException {
this.expect('[');
this.reader.skipWhitespace();
@@ -213,7 +260,7 @@ public class TagParser {
}
@@ -218,7 +265,7 @@ public class TagParser {
this.expect(']');
this.depth--; // Paper
- return listTag;
+ return exceedsDepthLimit(listTag) ? new ListTag() : listTag; // Scissors - Add depth limit to SNBT
}
}
@@ -238,7 +285,7 @@ public class TagParser {
@@ -243,7 +290,7 @@ public class TagParser {
}
private <T extends Number> List<T> readArray(TagType<?> arrayTypeReader, TagType<?> typeReader) throws CommandSyntaxException {
@ -84,22 +84,22 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..f112d82b0a9e5513395fa7c1b05d1fe9
while(true) {
if (this.reader.peek() != ']') {
@@ -251,11 +298,11 @@ public class TagParser {
@@ -256,11 +303,11 @@ public class TagParser {
}
if (typeReader == ByteTag.TYPE) {
- list.add((T)((NumericTag)tag).getAsByte());
+ list.add(((NumericTag)tag).getAsByte()); // Scissors - Remove (T) cast
- list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix
+ list.add(((NumericTag)tag).getAsNumber()); // Scissors - Remove (T) cast
} else if (typeReader == LongTag.TYPE) {
- list.add((T)((NumericTag)tag).getAsLong());
+ list.add(((NumericTag)tag).getAsLong()); // Scissors - Remove (T) cast
- list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix
+ list.add(((NumericTag)tag).getAsNumber()); // Scissors - Remove (T) cast
} else {
- list.add((T)((NumericTag)tag).getAsInt());
+ list.add(((NumericTag)tag).getAsInt()); // Scissors - Remove (T) cast
- list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix
+ list.add(((NumericTag)tag).getAsNumber()); // Scissors - Remove (T) cast
}
if (this.hasElementSeparator()) {
@@ -267,7 +314,7 @@ public class TagParser {
@@ -272,7 +319,7 @@ public class TagParser {
}
this.expect(']');