From a4fa08c227d6e887b96f70f672b8a4ac592220b8 Mon Sep 17 00:00:00 2001 From: apple502j <33279053+apple502j@users.noreply.github.com> Date: Mon, 22 Jan 2024 02:11:40 +0900 Subject: [PATCH] Some more renames (#3771) * Some more renames * Fix one yarn bug --- .../net/minecraft/network/NetworkPhase.mapping | 5 +++++ .../minecraft/network/NetworkStateType.mapping | 5 ----- .../minecraft/network/codec/PacketCodec.mapping | 15 +++++++++++---- .../minecraft/network/codec/PacketCodecs.mapping | 4 ++-- .../network/listener/PacketListener.mapping | 2 +- .../recipe/SpecialRecipeSerializer.mapping | 2 +- 6 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 mappings/net/minecraft/network/NetworkPhase.mapping delete mode 100644 mappings/net/minecraft/network/NetworkStateType.mapping diff --git a/mappings/net/minecraft/network/NetworkPhase.mapping b/mappings/net/minecraft/network/NetworkPhase.mapping new file mode 100644 index 0000000000..42eb2ac5b2 --- /dev/null +++ b/mappings/net/minecraft/network/NetworkPhase.mapping @@ -0,0 +1,5 @@ +CLASS net/minecraft/class_2539 net/minecraft/network/NetworkPhase + FIELD field_20594 id Ljava/lang/String; + METHOD (Ljava/lang/String;ILjava/lang/String;)V + ARG 3 id + METHOD method_10785 getId ()Ljava/lang/String; diff --git a/mappings/net/minecraft/network/NetworkStateType.mapping b/mappings/net/minecraft/network/NetworkStateType.mapping deleted file mode 100644 index 35389f36e2..0000000000 --- a/mappings/net/minecraft/network/NetworkStateType.mapping +++ /dev/null @@ -1,5 +0,0 @@ -CLASS net/minecraft/class_2539 net/minecraft/network/NetworkStateType - FIELD field_20594 stateId Ljava/lang/String; - METHOD (Ljava/lang/String;ILjava/lang/String;)V - ARG 3 stateId - METHOD method_10785 getId ()Ljava/lang/String; diff --git a/mappings/net/minecraft/network/codec/PacketCodec.mapping b/mappings/net/minecraft/network/codec/PacketCodec.mapping index 435cf4b9ba..6cbc3a5104 100644 --- a/mappings/net/minecraft/network/codec/PacketCodec.mapping +++ b/mappings/net/minecraft/network/codec/PacketCodec.mapping @@ -6,7 +6,7 @@ CLASS net/minecraft/class_9139 net/minecraft/network/codec/PacketCodec COMMENT code, use {@link #of(ValueFirstEncoder, PacketDecoder)} COMMENT like this: COMMENT - COMMENT

{@code
+	COMMENT 
{@code
 	COMMENT public static final PacketCodec CODEC = PacketCodec.of(MyPacket::write, MyPacket::new);
 	COMMENT
 	COMMENT private MyPacket(PacketByteBuf buf) {
@@ -30,6 +30,13 @@ CLASS net/minecraft/class_9139 net/minecraft/network/codec/PacketCodec
 	COMMENT phases (like configuration)
 	COMMENT @param  the type of the value to be encoded/decoded
 	METHOD method_56430 cast ()Lnet/minecraft/class_9139;
+		COMMENT {@return the same codec, casted to work with buffers of type {@code S}}
+		COMMENT
+		COMMENT @apiNote For example, {@link net.minecraft.util.math.BlockPos#PACKET_CODEC}
+		COMMENT is defined as {@code PacketCodec}. To use this codec
+		COMMENT where {@link net.minecraft.network.PacketByteBuf} is expected, you can call
+		COMMENT this method for easy casting, like: {@code PACKET_CODEC.cast()}.
+		COMMENT Doing this is generally safe and will not result in exceptions.
 	METHOD method_56431 unit (Ljava/lang/Object;)Lnet/minecraft/class_9139;
 		COMMENT {@return a codec that always returns {@code value}}
 		COMMENT
@@ -45,7 +52,7 @@ CLASS net/minecraft/class_9139 net/minecraft/network/codec/PacketCodec
 		COMMENT 

This can be used to transform a codec for a simple value (like a string) COMMENT into a corresponding, more complex value (like an identifier). An example: COMMENT - COMMENT

{@code
+		COMMENT 
{@code
 		COMMENT public static final PacketCodec PACKET_CODEC = PacketCodecs.STRING.xmap(Identifier::new, Identifier::toString);
 		COMMENT }
ARG 1 to @@ -83,7 +90,7 @@ CLASS net/minecraft/class_9139 net/minecraft/network/codec/PacketCodec ARG 4 codec3 ARG 5 from3 ARG 6 to - METHOD method_56437 of (Lnet/minecraft/class_9142;Lnet/minecraft/class_9141;)Lnet/minecraft/class_9139; + METHOD method_56437 ofStatic (Lnet/minecraft/class_9142;Lnet/minecraft/class_9141;)Lnet/minecraft/class_9139; COMMENT {@return a packet codec from the {@code encoder} and {@code decoder}} COMMENT COMMENT @apiNote This is useful for integrating with code that uses static methods for @@ -99,7 +106,7 @@ CLASS net/minecraft/class_9139 net/minecraft/network/codec/PacketCodec COMMENT @apiNote This is useful for integrating with code that uses instance methods for COMMENT packet writing, like {@code void write(PacketByteBuf buf)}. COMMENT For code that uses static methods like {@code static void write(PacketByteBuf buf, Data data)}, - COMMENT where the buffer is the first argument, use {@link #of(PacketEncoder, PacketDecoder)}. + COMMENT where the buffer is the first argument, use {@link #ofStatic(PacketEncoder, PacketDecoder)}. ARG 0 encoder ARG 1 decoder METHOD method_56439 mapBuf (Ljava/util/function/Function;)Lnet/minecraft/class_9139; diff --git a/mappings/net/minecraft/network/codec/PacketCodecs.mapping b/mappings/net/minecraft/network/codec/PacketCodecs.mapping index 244e502595..c14bec5679 100644 --- a/mappings/net/minecraft/network/codec/PacketCodecs.mapping +++ b/mappings/net/minecraft/network/codec/PacketCodecs.mapping @@ -38,7 +38,7 @@ CLASS net/minecraft/class_9135 net/minecraft/network/codec/PacketCodecs COMMENT @see io.netty.buffer.ByteBuf#readDouble COMMENT @see io.netty.buffer.ByteBuf#writeDouble FIELD field_48554 STRING Lnet/minecraft/class_9139; - COMMENT A codec for a string value with maximum length {@value Short.MAX_VALUE}. + COMMENT A codec for a string value with maximum length {@value Short#MAX_VALUE}. COMMENT COMMENT @see #string COMMENT @see net.minecraft.network.PacketByteBuf#readString() @@ -61,7 +61,7 @@ CLASS net/minecraft/class_9135 net/minecraft/network/codec/PacketCodecs COMMENT COMMENT @see #nbt COMMENT @see net.minecraft.network.PacketByteBuf#readNbt(PacketByteBuf) - COMMENT @see net.minecraft.network.PacketByteBuf#writeNbt(PacketByteBuf, NbtCompound) + COMMENT @see net.minecraft.network.PacketByteBuf#writeNbt(io.netty.buffer.ByteBuf, NbtElement) FIELD field_48558 VECTOR3F Lnet/minecraft/class_9139; COMMENT A codec for a {@link org.joml.Vector3f}. COMMENT diff --git a/mappings/net/minecraft/network/listener/PacketListener.mapping b/mappings/net/minecraft/network/listener/PacketListener.mapping index e386d5cccc..fcc34bf816 100644 --- a/mappings/net/minecraft/network/listener/PacketListener.mapping +++ b/mappings/net/minecraft/network/listener/PacketListener.mapping @@ -22,7 +22,7 @@ CLASS net/minecraft/class_2547 net/minecraft/network/listener/PacketListener COMMENT COMMENT @see ServerPacketListener METHOD method_48106 isConnectionOpen ()Z - METHOD method_52280 getState ()Lnet/minecraft/class_2539; + METHOD method_52280 getPhase ()Lnet/minecraft/class_2539; METHOD method_52413 accepts (Lnet/minecraft/class_2596;)Z ARG 1 packet METHOD method_52895 getSide ()Lnet/minecraft/class_2598; diff --git a/mappings/net/minecraft/recipe/SpecialRecipeSerializer.mapping b/mappings/net/minecraft/recipe/SpecialRecipeSerializer.mapping index ea7f1c00fb..e7e14a75b6 100644 --- a/mappings/net/minecraft/recipe/SpecialRecipeSerializer.mapping +++ b/mappings/net/minecraft/recipe/SpecialRecipeSerializer.mapping @@ -7,7 +7,7 @@ CLASS net/minecraft/class_1866 net/minecraft/recipe/SpecialRecipeSerializer COMMENT serializer have IDs starting with {@code crafting_special_}. All of their logic and ingredients COMMENT are also defined in code, which distinguishes them from "non-special" recipes. FIELD field_46106 codec Lcom/mojang/serialization/Codec; - FIELD field_48362 PACKET_CODEC Lnet/minecraft/class_9139; + FIELD field_48362 packetCodec Lnet/minecraft/class_9139; FIELD field_9046 factory Lnet/minecraft/class_1866$class_7711; METHOD (Lnet/minecraft/class_1866$class_7711;)V ARG 1 factory