Class PacketByteBufs
java.lang.Object
net.fabricmc.fabric.api.networking.v1.PacketByteBufs
Helper methods for working with and creating
PacketByteBufs.-
Method Summary
Modifier and TypeMethodDescriptionstatic PacketByteBufcopy(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.copyin a packet byte buf.static PacketByteBufcopy(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.copyin a packet byte buf.static PacketByteBufcreate()Returns a new heap memory-backed instance of packet byte buf.static PacketByteBufduplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.duplicatein a packet byte buf.static PacketByteBufempty()Returns an empty instance of packet byte buf.static PacketByteBufreadBytes(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readBytesin a packet byte buf.static PacketByteBufreadRetainedSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readRetainedSlicein a packet byte buf.static PacketByteBufreadSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readSlicein a packet byte buf.static PacketByteBufretainedDuplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedDuplicatein a packet byte buf.static PacketByteBufretainedSlice(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedSlicein a packet byte buf.static PacketByteBufretainedSlice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.retainedSlicein a packet byte buf.static PacketByteBufslice(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.slicein a packet byte buf.static PacketByteBufslice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.slicein a packet byte buf.
-
Method Details
-
empty
Returns an empty instance of packet byte buf.- Returns:
- an empty buf
-
create
Returns a new heap memory-backed instance of packet byte buf.- Returns:
- a new buf
-
readBytes
Wraps the newly created buf frombuf.readBytesin a packet byte buf.- Parameters:
buf- the original buflength- the number of bytes to transfer- Returns:
- the transferred bytes
- See Also:
-
readSlice
Wraps the newly created buf frombuf.readSlicein a packet byte buf.- Parameters:
buf- the original buflength- the size of the new slice- Returns:
- the newly created slice
- See Also:
-
readRetainedSlice
Wraps the newly created buf frombuf.readRetainedSlicein a packet byte buf.- Parameters:
buf- the original buflength- the size of the new slice- Returns:
- the newly created slice
- See Also:
-
copy
Wraps the newly created buf frombuf.copyin a packet byte buf.- Parameters:
buf- the original buf- Returns:
- a copy of the buf
- See Also:
-
copy
Wraps the newly created buf frombuf.copyin 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:
-
slice
Wraps the newly created buf frombuf.slicein a packet byte buf.- Parameters:
buf- the original buf- Returns:
- a slice of the buf
- See Also:
-
retainedSlice
Wraps the newly created buf frombuf.retainedSlicein a packet byte buf.- Parameters:
buf- the original buf- Returns:
- a slice of the buf
- See Also:
-
slice
Wraps the newly created buf frombuf.slicein 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:
-
retainedSlice
Wraps the newly created buf frombuf.retainedSlicein 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:
-
duplicate
Wraps the newly created buf frombuf.duplicatein a packet byte buf.- Parameters:
buf- the original buf- Returns:
- a duplicate of the buf
- See Also:
-
retainedDuplicate
Wraps the newly created buf frombuf.retainedDuplicatein a packet byte buf.- Parameters:
buf- the original buf- Returns:
- a duplicate of the buf
- See Also:
-