Class PacketByteBufs
java.lang.Object
net.fabricmc.fabric.api.networking.v1.PacketByteBufs
Helper methods for working with and creating
PacketByteBuf
s.-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.PacketByteBuf
copy
(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.copy
in a packet byte buf.static net.minecraft.network.PacketByteBuf
copy
(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.copy
in a packet byte buf.static net.minecraft.network.PacketByteBuf
create()
Returns a new heap memory-backed instance of packet byte buf.static net.minecraft.network.PacketByteBuf
duplicate
(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.duplicate
in a packet byte buf.static net.minecraft.network.PacketByteBuf
empty()
Returns an empty instance of packet byte buf.static net.minecraft.network.PacketByteBuf
readBytes
(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readBytes
in a packet byte buf.static net.minecraft.network.PacketByteBuf
readRetainedSlice
(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readRetainedSlice
in a packet byte buf.static net.minecraft.network.PacketByteBuf
readSlice
(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readSlice
in a packet byte buf.static net.minecraft.network.PacketByteBuf
retainedDuplicate
(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedDuplicate
in a packet byte buf.static net.minecraft.network.PacketByteBuf
retainedSlice
(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedSlice
in a packet byte buf.static net.minecraft.network.PacketByteBuf
retainedSlice
(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.retainedSlice
in a packet byte buf.static net.minecraft.network.PacketByteBuf
slice
(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.slice
in a packet byte buf.static net.minecraft.network.PacketByteBuf
slice
(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.slice
in a packet byte buf.
-
Method Details
-
empty
public static net.minecraft.network.PacketByteBuf empty()Returns an empty instance of packet byte buf.- Returns:
- an empty buf
-
create
public static net.minecraft.network.PacketByteBuf create()Returns a new heap memory-backed instance of packet byte buf.- Returns:
- a new buf
-
readBytes
public static net.minecraft.network.PacketByteBuf readBytes(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readBytes
in a packet byte buf.- Parameters:
buf
- the original buflength
- the number of bytes to transfer- Returns:
- the transferred bytes
- See Also:
-
ByteBuf.readBytes(int)
-
readSlice
public static net.minecraft.network.PacketByteBuf readSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readSlice
in a packet byte buf.- Parameters:
buf
- the original buflength
- the size of the new slice- Returns:
- the newly created slice
- See Also:
-
ByteBuf.readSlice(int)
-
readRetainedSlice
public static net.minecraft.network.PacketByteBuf readRetainedSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readRetainedSlice
in a packet byte buf.- Parameters:
buf
- the original buflength
- the size of the new slice- Returns:
- the newly created slice
- See Also:
-
ByteBuf.readRetainedSlice(int)
-
copy
public static net.minecraft.network.PacketByteBuf copy(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.copy
in a packet byte buf.- Parameters:
buf
- the original buf- Returns:
- a copy of the buf
- See Also:
-
ByteBuf.copy()
-
copy
public static net.minecraft.network.PacketByteBuf copy(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.copy
in a packet byte buf.- Parameters:
buf
- the original bufindex
- the starting indexlength
- the size of the copy- Returns:
- a copy of the buf
- See Also:
-
ByteBuf.copy(int, int)
-
slice
public static net.minecraft.network.PacketByteBuf slice(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.slice
in a packet byte buf.- Parameters:
buf
- the original buf- Returns:
- a slice of the buf
- See Also:
-
ByteBuf.slice()
-
retainedSlice
public static net.minecraft.network.PacketByteBuf retainedSlice(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedSlice
in a packet byte buf.- Parameters:
buf
- the original buf- Returns:
- a slice of the buf
- See Also:
-
ByteBuf.retainedSlice()
-
slice
public static net.minecraft.network.PacketByteBuf slice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.slice
in a packet byte buf.- Parameters:
buf
- the original bufindex
- the starting indexlength
- the size of the copy- Returns:
- a slice of the buf
- See Also:
-
ByteBuf.slice(int, int)
-
retainedSlice
public static net.minecraft.network.PacketByteBuf retainedSlice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.retainedSlice
in a packet byte buf.- Parameters:
buf
- the original bufindex
- the starting indexlength
- the size of the copy- Returns:
- a slice of the buf
- See Also:
-
ByteBuf.retainedSlice(int, int)
-
duplicate
public static net.minecraft.network.PacketByteBuf duplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.duplicate
in a packet byte buf.- Parameters:
buf
- the original buf- Returns:
- a duplicate of the buf
- See Also:
-
ByteBuf.duplicate()
-
retainedDuplicate
public static net.minecraft.network.PacketByteBuf retainedDuplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedDuplicate
in a packet byte buf.- Parameters:
buf
- the original buf- Returns:
- a duplicate of the buf
- See Also:
-
ByteBuf.retainedDuplicate()
-