From f7f320f7305c92be62c1cf96679b03c29bb3b87d Mon Sep 17 00:00:00 2001 From: haykam821 <24855774+haykam821@users.noreply.github.com> Date: Wed, 13 Dec 2023 08:00:51 -0500 Subject: [PATCH] Rename the NbtTagSizeTracker class to NbtSizeTracker (#3753) --- mappings/net/minecraft/nbt/NbtIo.mapping | 20 +++++++++---------- ...Tracker.mapping => NbtSizeTracker.mapping} | 2 +- .../minecraft/network/PacketByteBuf.mapping | 12 +++++------ unpick-definitions/network.unpick | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) rename mappings/net/minecraft/nbt/{NbtTagSizeTracker.mapping => NbtSizeTracker.mapping} (92%) diff --git a/mappings/net/minecraft/nbt/NbtIo.mapping b/mappings/net/minecraft/nbt/NbtIo.mapping index 518ac52c4d..7e090b54db 100644 --- a/mappings/net/minecraft/nbt/NbtIo.mapping +++ b/mappings/net/minecraft/nbt/NbtIo.mapping @@ -1,7 +1,7 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT A set of utility functions for reading, writing, and scanning NBT files. - COMMENT Methods that do not require {@link NbtTagSizeTracker} accept any bytes of data, - COMMENT provided that its depth does not exceed {@value NbtTagSizeTracker#DEFAULT_MAX_DEPTH}. + COMMENT Methods that do not require {@link NbtSizeTracker} accept any bytes of data, + COMMENT provided that its depth does not exceed {@value NbtSizeTracker#DEFAULT_MAX_DEPTH}. COMMENT COMMENT

When {@linkplain DataOutput#writeUTF writing an invalid string}, methods in COMMENT this class will write an empty string instead of crashing, with the exception of @@ -41,7 +41,7 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT @throws IOException if the IO operation fails or if the root NBT element is COMMENT not a compound COMMENT @throws NbtSizeValidationException if the NBT is too deep - COMMENT @see #readCompressed(Path, NbtTagSizeTracker) + COMMENT @see #readCompressed(Path, NbtSizeTracker) ARG 0 stream ARG 1 tagSizeTracker METHOD method_10630 write (Lnet/minecraft/class_2487;Ljava/nio/file/Path;)V @@ -60,7 +60,7 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT method will throw an error, unlike other methods. COMMENT COMMENT @throws IOException if the IO operation fails - COMMENT @see #read(DataInput, NbtTagSizeTracker) + COMMENT @see #read(DataInput, NbtSizeTracker) COMMENT @see #writeForPacket(NbtElement, DataOutput) COMMENT @see #write(NbtElement, DataOutput) ARG 0 nbt @@ -87,7 +87,7 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT @throws IOException if the IO operation fails or if the root NBT element is COMMENT not a compound COMMENT @throws NbtSizeValidationException if the NBT is too deep - COMMENT @see #readCompressed(InputStream, NbtTagSizeTracker) + COMMENT @see #readCompressed(InputStream, NbtSizeTracker) ARG 0 path ARG 1 tagSizeTracker METHOD method_30614 writeCompressed (Lnet/minecraft/class_2487;Ljava/nio/file/Path;)V @@ -118,7 +118,7 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @throws NbtSizeValidationException if the {@code tracker}'s validation fails - COMMENT @see #scanCompressed(InputStream, NbtScanner, NbtTagSizeTracker) + COMMENT @see #scanCompressed(InputStream, NbtScanner, NbtSizeTracker) ARG 0 path ARG 1 scanner ARG 2 tracker @@ -131,7 +131,7 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @throws NbtSizeValidationException if the {@code tracker}'s validation fails - COMMENT @see #scanCompressed(Path, NbtScanner, NbtTagSizeTracker) + COMMENT @see #scanCompressed(Path, NbtScanner, NbtSizeTracker) ARG 0 stream ARG 1 scanner ARG 2 tracker @@ -148,13 +148,13 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT COMMENT @apiNote In vanilla, this is used exclusively in networking. COMMENT @throws IOException if the IO operation fails - COMMENT @see #read(DataInput, NbtTagSizeTracker) + COMMENT @see #read(DataInput, NbtSizeTracker) COMMENT @see #write(NbtElement, DataOutput) ARG 0 nbt ARG 1 output METHOD method_52894 read (Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2520; COMMENT Reads an NBT element from {@code input}. Unlike {@link - COMMENT #readCompound(DataInput, NbtTagSizeTracker)}, the element does not have to + COMMENT #readCompound(DataInput, NbtSizeTracker)}, the element does not have to COMMENT be a compound. COMMENT COMMENT @return the NBT element from the input @@ -174,7 +174,7 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT method will write an empty string instead of crashing. COMMENT COMMENT @throws IOException if the IO operation fails - COMMENT @see #read(DataInput, NbtTagSizeTracker) + COMMENT @see #read(DataInput, NbtSizeTracker) COMMENT @see #writeForPacket(NbtElement, DataOutput) COMMENT @see #writeUnsafe(NbtElement, DataOutput) ARG 0 nbt diff --git a/mappings/net/minecraft/nbt/NbtTagSizeTracker.mapping b/mappings/net/minecraft/nbt/NbtSizeTracker.mapping similarity index 92% rename from mappings/net/minecraft/nbt/NbtTagSizeTracker.mapping rename to mappings/net/minecraft/nbt/NbtSizeTracker.mapping index ad76e358ec..bb3ca632d6 100644 --- a/mappings/net/minecraft/nbt/NbtTagSizeTracker.mapping +++ b/mappings/net/minecraft/nbt/NbtSizeTracker.mapping @@ -1,4 +1,4 @@ -CLASS net/minecraft/class_2505 net/minecraft/nbt/NbtTagSizeTracker +CLASS net/minecraft/class_2505 net/minecraft/nbt/NbtSizeTracker COMMENT Tracks the size of NBT elements in bytes and in depth. Throws {@link COMMENT NbtSizeValidationException} if the tracked element becomes larger than {@link COMMENT #maxBytes} or if the depth exceeds {@link #maxDepth} during addition. diff --git a/mappings/net/minecraft/network/PacketByteBuf.mapping b/mappings/net/minecraft/network/PacketByteBuf.mapping index c4db57aae4..594e8a8deb 100644 --- a/mappings/net/minecraft/network/PacketByteBuf.mapping +++ b/mappings/net/minecraft/network/PacketByteBuf.mapping @@ -9,7 +9,7 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf COMMENT Object Type read method write method COMMENT COMMENT - COMMENT Codec-based (NBT){@link #decode(DynamicOps, Codec, NbtTagSizeTracker)}{@link #encode(DynamicOps, Codec, Object)} + COMMENT Codec-based (NBT){@link #decode(DynamicOps, Codec, NbtSizeTracker)}{@link #encode(DynamicOps, Codec, Object)} COMMENT COMMENT COMMENT Codec-based (JSON){@link #decodeAsJson(Codec)}{@link #encodeAsJson(Codec, Object)} @@ -351,7 +351,7 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf COMMENT @throws io.netty.handler.codec.EncoderException if the NBT cannot be COMMENT written COMMENT @see #readNbt() - COMMENT @see #readNbt(NbtTagSizeTracker) + COMMENT @see #readNbt(NbtSizeTracker) ARG 1 nbt METHOD method_10795 readByteArray ()[B COMMENT Reads an array of primitive bytes from this buf. The array first has a @@ -383,14 +383,14 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf COMMENT this method returns {@code null}. The compound can have a maximum size of COMMENT {@value #MAX_READ_NBT_SIZE} bytes. COMMENT - COMMENT

Note that unlike {@link #readNbt(NbtTagSizeTracker)}, this can only + COMMENT

Note that unlike {@link #readNbt(NbtSizeTracker)}, this can only COMMENT read compounds. COMMENT COMMENT @return the read compound, may be {@code null} COMMENT @throws io.netty.handler.codec.EncoderException if the NBT cannot be read COMMENT @throws net.minecraft.nbt.NbtSizeValidationException if the compound exceeds the allowed maximum size COMMENT @see #writeNbt(NbtCompound) - COMMENT @see #readNbt(NbtTagSizeTracker) + COMMENT @see #readNbt(NbtSizeTracker) COMMENT @see #MAX_READ_NBT_SIZE METHOD method_10799 readIntArray (I)[I COMMENT Reads an array of primitive ints from this buf. The array first has a @@ -494,7 +494,7 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf COMMENT the pos to write METHOD method_10808 readText ()Lnet/minecraft/class_2561; COMMENT Reads a text from this buf. A text is represented as an NBT-encoded data - COMMENT with {@linkplain NbtTagSizeTracker the maximum size} as {@value #MAX_READ_NBT_SIZE}. + COMMENT with {@linkplain NbtSizeTracker the maximum size} as {@value #MAX_READ_NBT_SIZE}. COMMENT COMMENT @return the read text COMMENT @throws io.netty.handler.codec.EncoderException if the NBT cannot be read @@ -647,7 +647,7 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf COMMENT @param the encoded object's type COMMENT @throws io.netty.handler.codec.EncoderException if the {@code codec} fails COMMENT to encode the compound NBT - COMMENT @see #decode(DynamicOps, Codec, NbtTagSizeTracker) + COMMENT @see #decode(DynamicOps, Codec, NbtSizeTracker) ARG 1 ops ARG 2 codec ARG 3 value diff --git a/unpick-definitions/network.unpick b/unpick-definitions/network.unpick index 2b3543b570..3d620d7f1f 100644 --- a/unpick-definitions/network.unpick +++ b/unpick-definitions/network.unpick @@ -12,7 +12,7 @@ target_method net/minecraft/network/PacketByteBuf readString (I)Ljava/lang/Strin target_method net/minecraft/network/PacketByteBuf writeString (Ljava/lang/String;I)Lnet/minecraft/network/PacketByteBuf; param 1 max_string_length # somehow does not work -#target_method net/minecraft/nbt/NbtTagSizeTracker (J)V +#target_method net/minecraft/nbt/NbtSizeTracker (J)V # param 0 max_nbt_size target_method net/minecraft/network/encoding/VarInts getSizeInBytes (I)I return max_var_int_length