Skip to content

Commit

Permalink
23w31a more networking (#3621)
Browse files Browse the repository at this point in the history
  • Loading branch information
apple502j authored Aug 5, 2023
1 parent c9b86e0 commit 3f333bf
Show file tree
Hide file tree
Showing 18 changed files with 193 additions and 37 deletions.
39 changes: 35 additions & 4 deletions mappings/net/minecraft/nbt/NbtIo.mapping
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo
COMMENT A set of utility functions for reading, writing, and scanning NBT files.
METHOD method_10625 read (Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2487;
METHOD method_10625 readCompound (Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2487;
COMMENT Reads an NBT compound from {@code input}.
COMMENT
COMMENT @return the NBT compound from the input
Expand All @@ -12,15 +12,15 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo
ARG 0 input
ARG 1 depth
ARG 2 tracker
METHOD method_10627 read (Ljava/io/DataInput;)Lnet/minecraft/class_2487;
METHOD method_10627 readCompound (Ljava/io/DataInput;)Lnet/minecraft/class_2487;
COMMENT Reads an NBT compound from {@code input}.
COMMENT
COMMENT @return the NBT compound from the input
COMMENT @throws IOException if the IO operation fails or if the root NBT element is
COMMENT not a compound
ARG 0 input
METHOD method_10628 write (Lnet/minecraft/class_2487;Ljava/io/DataOutput;)V
COMMENT Writes the {@code nbt} to {@code file}.
METHOD method_10628 writeCompound (Lnet/minecraft/class_2487;Ljava/io/DataOutput;)V
COMMENT Writes the {@code nbt} to {@code output}.
COMMENT
COMMENT @throws IOException if the IO operation fails
COMMENT @see #write(NbtCompound, File)
Expand All @@ -42,6 +42,13 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo
ARG 0 nbt
ARG 1 file
METHOD method_10631 write (Lnet/minecraft/class_2520;Ljava/io/DataOutput;)V
COMMENT Writes the {@code nbt} to {@code output}. The output is the byte indicating
COMMENT the element type, followed by {@linkplain DataOutput#writeUTF an empty string}
COMMENT and the NBT data.
COMMENT
COMMENT @throws IOException if the IO operation fails
COMMENT @see #read(DataInput, NbtTagSizeTracker)
COMMENT @see #writeForPacket(NbtElement, DataOutput)
ARG 0 nbt
ARG 1 output
METHOD method_10633 read (Ljava/io/File;)Lnet/minecraft/class_2487;
Expand Down Expand Up @@ -108,3 +115,27 @@ CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo
METHOD method_40059 decompress (Ljava/io/InputStream;)Ljava/io/DataInputStream;
COMMENT {@return a new input stream that decompresses the input {@code stream}}
ARG 0 stream
METHOD method_52892 read (Ljava/io/DataInput;ILnet/minecraft/class_2505;B)Lnet/minecraft/class_2520;
ARG 0 input
ARG 1 depth
ARG 2 tracker
ARG 3 type
METHOD method_52893 writeForPacket (Lnet/minecraft/class_2520;Ljava/io/DataOutput;)V
COMMENT Writes the {@code nbt} to {@code output}. The output is the byte indicating
COMMENT the element type, followed by the NBT data.
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 #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 be a compound.
COMMENT
COMMENT @return the NBT element from the input
COMMENT @throws IOException if the IO operation fails
ARG 0 input
ARG 1 tracker
29 changes: 15 additions & 14 deletions mappings/net/minecraft/network/PacketByteBuf.mapping
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf
COMMENT <td>{@link RegistryKey}</td><td>{@link #readRegistryKey(RegistryKey)}</td><td>{@link #writeRegistryKey(RegistryKey)}</td>
COMMENT </tr>
COMMENT <tr>
COMMENT <td>{@link RegistryKey} of a registry</td><td>{@link #readRegistryKey()}</td><td>{@link #writeRegistryKey(RegistryKey)}</td>
COMMENT <td>{@link RegistryKey} of a registry</td><td>{@link #readRegistryRef()}</td><td>{@link #writeRegistryKey(RegistryKey)}</td>
COMMENT </tr>
COMMENT <tr>
COMMENT <td>{@link Date}</td><td>{@link #readDate()}</td><td>{@link #writeDate(Date)}</td>
Expand Down Expand Up @@ -324,7 +324,7 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf
COMMENT
COMMENT @return this buf, for chaining
COMMENT @see #readVarLong()
COMMENT @see #getVarLongLength(long)
COMMENT @see net.minecraft.network.encoding.VarLong
ARG 1 value
COMMENT the value to write
METHOD method_10792 readVarLong ()J
Expand All @@ -343,16 +343,16 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf
ARG 1 stack
COMMENT the stack to write
METHOD method_10794 writeNbt (Lnet/minecraft/class_2520;)Lnet/minecraft/class_2540;
COMMENT Writes an NBT compound to this buf. The binary representation of NBT is
COMMENT handled by {@link net.minecraft.nbt.NbtIo}. If {@code compound} is {@code
COMMENT Writes an NBT element to this buf. The binary representation of NBT is
COMMENT handled by {@link net.minecraft.nbt.NbtIo}. If {@code nbt} is {@code
COMMENT null}, it is treated as an NBT null.
COMMENT
COMMENT @return this buf, for chaining
COMMENT @throws io.netty.handler.codec.EncoderException if the NBT cannot be
COMMENT written
COMMENT @see #readNbt()
COMMENT @see #readUnlimitedNbt()
COMMENT @see #readNbt(NbtTagSizeTracker)
ARG 1 nbt
METHOD method_10795 readByteArray ()[B
COMMENT Reads an array of primitive bytes from this buf. The array first has a
COMMENT var int indicating its length, followed by the actual bytes. The array
Expand Down Expand Up @@ -383,11 +383,13 @@ 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 <p>Note that unlike {@link #readNbt(NbtTagSizeTracker)}, 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 RuntimeException if the compound exceeds the allowed maximum size
COMMENT @see #writeNbt(NbtCompound)
COMMENT @see #readUnlimitedNbt()
COMMENT @see #readNbt(NbtTagSizeTracker)
COMMENT @see #MAX_READ_NBT_SIZE
METHOD method_10799 readIntArray (I)[I
Expand Down Expand Up @@ -459,7 +461,7 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf
COMMENT
COMMENT @return this buf, for chaining
COMMENT @see #readVarInt()
COMMENT @see #getVarIntLength(int)
COMMENT @see net.minecraft.network.encoding.VarInts
ARG 1 value
COMMENT the value to write
METHOD method_10805 writeText (Lnet/minecraft/class_2561;)Lnet/minecraft/class_2540;
Expand Down Expand Up @@ -652,17 +654,16 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf
ARG 2 codec
ARG 3 value
METHOD method_30616 readNbt (Lnet/minecraft/class_2505;)Lnet/minecraft/class_2520;
COMMENT Reads an NBT compound from this buf. The binary representation of NBT is
COMMENT Reads an NBT element from this buf. The binary representation of NBT is
COMMENT handled by {@link net.minecraft.nbt.NbtIo}. If an NBT null is encountered,
COMMENT this method returns {@code null}. The compound can have a maximum size
COMMENT this method returns {@code null}. The element can have a maximum size
COMMENT controlled by the {@code sizeTracker}.
COMMENT
COMMENT @return the read compound, may be {@code null}
COMMENT @return the read element, may be {@code null}
COMMENT @throws io.netty.handler.codec.EncoderException if the NBT cannot be read
COMMENT @throws RuntimeException if the compound exceeds the allowed maximum size
COMMENT @see #writeNbt(NbtCompound)
COMMENT @throws RuntimeException if the element exceeds the allowed maximum size
COMMENT @see #writeNbt(NbtElement)
COMMENT @see #readNbt()
COMMENT @see #readUnlimitedNbt()
ARG 1 sizeTracker
METHOD method_33134 readLongArray ()[J
COMMENT Reads an array of primitive longs from this buf. The array first has a
Expand Down Expand Up @@ -1098,7 +1099,7 @@ CLASS net/minecraft/class_2540 net/minecraft/network/PacketByteBuf
COMMENT Converts {@code value} to an integer representing its ID, then
COMMENT writes a {@linkplain #readVarInt var int} representation of such ID.
COMMENT
COMMENT @see #decode(ToIntFunction)
COMMENT @see #decode(IntFunction)
ARG 1 valueToId
COMMENT a function that gets the value's integer ID
ARG 2 value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ CLASS net/minecraft/class_2792 net/minecraft/network/listener/ServerPlayPacketLi
ARG 1 packet
METHOD method_46367 onPlayerSession (Lnet/minecraft/class_7861;)V
ARG 1 packet
METHOD method_52278 onChunkBatchSize (Lnet/minecraft/class_8590;)V
METHOD method_52278 onAcknowledgeChunks (Lnet/minecraft/class_8590;)V
ARG 1 packet
METHOD method_52279 onAcknowledgeReconfiguration (Lnet/minecraft/class_8591;)V
ARG 1 packet
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ CLASS net/minecraft/class_6374 net/minecraft/network/packet/c2s/common/PlayPongC
COMMENT play ping packet from the server, passing the {@link #parameter} back to the
COMMENT server.
COMMENT
COMMENT @see net.minecraft.network.packet.s2c.play.PlayPingS2CPacket
COMMENT @see net.minecraft.network.packet.c2s.play.KeepAliveC2SPacket
COMMENT @see net.minecraft.network.packet.s2c.common.PlayPingS2CPacket
COMMENT @see net.minecraft.network.packet.c2s.common.KeepAliveC2SPacket
COMMENT @see net.minecraft.network.packet.c2s.query.QueryPingC2SPacket
FIELD field_33752 parameter I
METHOD <init> (I)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ CLASS net/minecraft/class_2913 net/minecraft/network/packet/c2s/login/LoginQuery
FIELD field_33374 MAX_PAYLOAD_SIZE I
METHOD comp_1569 queryId ()I
METHOD comp_1570 response ()Lnet/minecraft/class_8594;
METHOD method_52290 readResponse (ILnet/minecraft/class_2540;)Lnet/minecraft/class_8594;
COMMENT {@return the response read from {@code buf}}
METHOD method_52290 readPayload (ILnet/minecraft/class_2540;)Lnet/minecraft/class_8594;
COMMENT {@return the response payload read from {@code buf}}
COMMENT
COMMENT @implNote This delegates the logic to {@link #getVanillaResponse},
COMMENT @implNote This delegates the logic to {@link #getVanillaPayload},
COMMENT which simply validates the size of the buffer and returns {@link
COMMENT EmptyLoginQueryResponse#INSTANCE}.
COMMENT UnknownLoginQueryResponsePayload#INSTANCE}.
ARG 0 queryId
ARG 1 buf
METHOD method_52291 (Lnet/minecraft/class_2540;Lnet/minecraft/class_8594;)V
ARG 0 buf
ARG 1 response
METHOD method_52292 read (Lnet/minecraft/class_2540;)Lnet/minecraft/class_2913;
ARG 0 buf
METHOD method_52293 getVanillaResponse (Lnet/minecraft/class_2540;)Lnet/minecraft/class_8594;
METHOD method_52293 getVanillaPayload (Lnet/minecraft/class_2540;)Lnet/minecraft/class_8594;
ARG 0 buf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CLASS net/minecraft/class_8594 net/minecraft/network/packet/c2s/login/LoginQueryResponse
CLASS net/minecraft/class_8594 net/minecraft/network/packet/c2s/login/LoginQueryResponsePayload
METHOD method_52295 write (Lnet/minecraft/class_2540;)V
ARG 1 buf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CLASS net/minecraft/class_8596 net/minecraft/network/packet/c2s/login/EmptyLoginQueryResponse
CLASS net/minecraft/class_8596 net/minecraft/network/packet/c2s/login/UnknownLoginQueryResponsePayload
FIELD field_44980 INSTANCE Lnet/minecraft/class_8596;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CLASS net/minecraft/class_8590 net/minecraft/network/packet/c2s/play/ChunkBatchSizeC2SPacket
CLASS net/minecraft/class_8590 net/minecraft/network/packet/c2s/play/AcknowledgeChunksC2SPacket
METHOD <init> (Lnet/minecraft/class_2540;)V
ARG 1 buf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ CLASS net/minecraft/class_6373 net/minecraft/network/packet/s2c/common/PlayPingS
COMMENT A packet sent by the server; the client will reply with a pong packet on the
COMMENT first tick after it receives this packet, with the same {@link #parameter}.
COMMENT
COMMENT @see net.minecraft.network.packet.c2s.play.PlayPongC2SPacket
COMMENT @see net.minecraft.network.packet.s2c.play.KeepAliveS2CPacket
COMMENT @see net.minecraft.network.packet.c2s.common.PlayPongC2SPacket
COMMENT @see net.minecraft.network.packet.s2c.common.KeepAliveS2CPacket
COMMENT @see net.minecraft.network.packet.s2c.query.QueryPongS2CPacket
FIELD field_33751 parameter I
COMMENT The parameter of this ping packet.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
CLASS net/minecraft/class_8726 net/minecraft/network/packet/s2c/custom/DebugStructuresCustomPayload
FIELD field_45710 ID Lnet/minecraft/class_2960;
METHOD <init> (Lnet/minecraft/class_2540;)V
ARG 1 buf
METHOD method_53037 writeBox (Lnet/minecraft/class_2540;Lnet/minecraft/class_3341;)V
ARG 0 buf
ARG 1 box
METHOD method_53038 (Lnet/minecraft/class_2540;Lnet/minecraft/class_2540;Lnet/minecraft/class_8726$class_8727;)V
ARG 1 buf2
ARG 2 piece
METHOD method_53039 readBox (Lnet/minecraft/class_2540;)Lnet/minecraft/class_3341;
ARG 0 buf
CLASS class_8727 Piece
METHOD <init> (Lnet/minecraft/class_2540;)V
ARG 1 buf
METHOD method_53040 write (Lnet/minecraft/class_2540;)V
ARG 1 buf
29 changes: 28 additions & 1 deletion mappings/net/minecraft/server/network/ChunkDataSender.mapping
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
CLASS net/minecraft/class_8608 net/minecraft/server/network/ChunkDataSender
METHOD method_52383 setDesiredBatchSize (F)V
FIELD field_45002 LOGGER Lorg/slf4j/Logger;
FIELD field_45005 chunks Lit/unimi/dsi/fastutil/longs/LongSet;
FIELD field_45006 local Z
FIELD field_45007 desiredBatchSize F
FIELD field_45008 pending F
FIELD field_45009 unacknowledgedBatches I
FIELD field_45010 maxUnacknowledgedBatches I
METHOD <init> (Z)V
ARG 1 local
METHOD method_52383 onAcknowledgeChunks (F)V
ARG 1 desiredBatchSize
METHOD method_52384 isInNextBatch (J)Z
ARG 1 chunkPos
METHOD method_52385 makeBatch (Lnet/minecraft/class_3898;Lnet/minecraft/class_1923;)Ljava/util/List;
ARG 1 chunkStorage
ARG 2 playerPos
METHOD method_52386 sendChunkBatches (Lnet/minecraft/class_3222;)V
ARG 1 player
METHOD method_52387 unload (Lnet/minecraft/class_3222;Lnet/minecraft/class_1923;)V
ARG 1 player
ARG 2 pos
METHOD method_52388 sendChunkData (Lnet/minecraft/class_3244;Lnet/minecraft/class_3218;Lnet/minecraft/class_2818;)V
ARG 0 handler
ARG 1 world
ARG 2 chunk
METHOD method_52389 (Lnet/minecraft/class_1923;Lnet/minecraft/class_2818;)I
ARG 1 chunk
METHOD method_52390 add (Lnet/minecraft/class_2818;)V
ARG 1 chunk
44 changes: 44 additions & 0 deletions mappings/net/minecraft/server/network/ChunkFilter.mapping
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
CLASS net/minecraft/class_8603 net/minecraft/server/network/ChunkFilter
FIELD field_44986 IGNORE_ALL Lnet/minecraft/class_8603;
METHOD method_52356 isWithinDistance (II)Z
ARG 1 x
ARG 2 z
METHOD method_52357 isWithinDistanceExcludingEdge (IIIII)Z
ARG 0 centerX
ARG 1 centerZ
ARG 2 viewDistance
ARG 3 x
ARG 4 z
METHOD method_52358 isWithinDistance (IIIIIZ)Z
ARG 0 centerX
ARG 1 centerZ
ARG 2 viewDistance
ARG 3 x
ARG 4 z
ARG 5 includeEdge
METHOD method_52359 isWithinDistance (IIZ)Z
ARG 1 x
ARG 2 z
ARG 3 includeEdge
METHOD method_52360 forEachChangedChunk (Lnet/minecraft/class_8603;Lnet/minecraft/class_8603;Ljava/util/function/Consumer;Ljava/util/function/Consumer;)V
ARG 0 oldFilter
ARG 1 newFilter
ARG 2 newlyIncluded
ARG 3 justRemoved
METHOD method_52361 isWithinDistance (Lnet/minecraft/class_1923;)Z
ARG 1 pos
METHOD method_52362 cylindrical (Lnet/minecraft/class_1923;I)Lnet/minecraft/class_8603;
ARG 0 center
ARG 1 viewDistance
METHOD method_52363 forEach (Ljava/util/function/Consumer;)V
ARG 1 consumer
METHOD method_52364 isWithinDistanceExcludingEdge (II)Z
ARG 1 x
ARG 2 z
CLASS class_8604 Cylindrical
METHOD method_52365 overlaps (Lnet/minecraft/class_8603$class_8604;)Z
ARG 1 o
METHOD method_52366 getLeft ()I
METHOD method_52367 getBottom ()I
METHOD method_52368 getRight ()I
METHOD method_52369 getTop ()I
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ CLASS net/minecraft/class_4209 net/minecraft/server/network/DebugInfoSender
ARG 4 duration
METHOD method_22319 sendToAll (Lnet/minecraft/class_3218;Lnet/minecraft/class_8710;)V
ARG 0 world
ARG 1 payload
METHOD method_23855 sendBeeDebugData (Lnet/minecraft/class_4466;)V
ARG 0 bee
METHOD method_23856 sendBeehiveDebugData (Lnet/minecraft/class_1937;Lnet/minecraft/class_2338;Lnet/minecraft/class_2680;Lnet/minecraft/class_4482;)V
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CLASS net/minecraft/class_5629 net/minecraft/server/network/PlayerAssociatedNetworkHandler
METHOD method_14364 sendPacket (Lnet/minecraft/class_2596;)V
ARG 1 packet
METHOD method_32311 getPlayer ()Lnet/minecraft/class_3222;
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CLASS net/minecraft/class_3222 net/minecraft/server/network/ServerPlayerEntity
FIELD field_39985 sculkShriekerWarningManager Lnet/minecraft/class_7262;
FIELD field_39986 session Lnet/minecraft/class_7822;
FIELD field_44990 viewDistance Ljava/util/OptionalInt;
FIELD field_44991 chunkFilter Lnet/minecraft/class_8603;
METHOD <init> (Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/class_3218;Lcom/mojang/authlib/GameProfile;)V
ARG 1 server
ARG 2 world
Expand Down Expand Up @@ -238,6 +239,9 @@ CLASS net/minecraft/class_3222 net/minecraft/server/network/ServerPlayerEntity
ARG 1 world
METHOD method_51469 getServerWorld ()Lnet/minecraft/class_3218;
METHOD method_52371 getViewDistance ()Ljava/util/OptionalInt;
METHOD method_52372 getChunkFilter ()Lnet/minecraft/class_8603;
METHOD method_52373 setChunkFilter (Lnet/minecraft/class_8603;)V
ARG 1 chunkFilter
METHOD method_52374 createCommonPlayerSpawnInfo (Lnet/minecraft/class_3218;)Lnet/minecraft/class_8589;
ARG 1 world
METHOD method_7336 changeGameMode (Lnet/minecraft/class_1934;)Z
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ CLASS net/minecraft/class_3210 net/minecraft/server/world/PlayerChunkWatchingMan
ARG 1 player
METHOD method_14083 getPlayersWatchingChunk ()Ljava/util/Set;
METHOD method_14084 remove (Lnet/minecraft/class_3222;)V
ARG 1 player
METHOD method_14085 add (Lnet/minecraft/class_3222;Z)V
ARG 1 player
ARG 2 inactive
METHOD method_14086 disableWatch (Lnet/minecraft/class_3222;)V
ARG 1 player
METHOD method_14087 enableWatch (Lnet/minecraft/class_3222;)V
Expand Down
Loading

0 comments on commit 3f333bf

Please sign in to comment.