Class PacketByteBufs
java.lang.Object
io.github.fablabsmc.fablabs.api.networking.v1.util.PacketByteBufs
public final class PacketByteBufs extends Object
Utilities for working with packet byte bufs.
-
Method Summary
Modifier and Type Method Description static net.minecraft.network.PacketByteBufcopy(ByteBuf buf)Wraps the newly created buf frombuf.copyin a packet byte buf.static net.minecraft.network.PacketByteBufcopy(ByteBuf buf, int index, int length)Wraps the newly created buf frombuf.copyin a packet byte buf.static net.minecraft.network.PacketByteBufcreate()Returns a new heap memory-backed instance of packet byte buf.static net.minecraft.network.PacketByteBufduplicate(ByteBuf buf)Wraps the newly created buf frombuf.duplicatein a packet byte buf.static net.minecraft.network.PacketByteBufempty()Returns an empty instance of packet byte buf.static net.minecraft.network.PacketByteBufreadBytes(ByteBuf buf, int length)Wraps the newly created buf frombuf.readBytesin a packet byte buf.static net.minecraft.network.PacketByteBufreadRetainedSlice(ByteBuf buf, int length)Wraps the newly created buf frombuf.readRetainedSlicein a packet byte buf.static net.minecraft.network.PacketByteBufreadSlice(ByteBuf buf, int length)Wraps the newly created buf frombuf.readSlicein a packet byte buf.static net.minecraft.network.PacketByteBufretainedDuplicate(ByteBuf buf)Wraps the newly created buf frombuf.retainedDuplicatein a packet byte buf.static net.minecraft.network.PacketByteBufretainedSlice(ByteBuf buf)Wraps the newly created buf frombuf.retainedSlicein a packet byte buf.static net.minecraft.network.PacketByteBufretainedSlice(ByteBuf buf, int index, int length)Wraps the newly created buf frombuf.retainedSlicein a packet byte buf.static net.minecraft.network.PacketByteBufslice(ByteBuf buf)Wraps the newly created buf frombuf.slicein a packet byte buf.static net.minecraft.network.PacketByteBufslice(ByteBuf buf, int index, int length)Wraps the newly created buf frombuf.slicein 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
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:
ByteBuf.readBytes(int)
-
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:
ByteBuf.readSlice(int)
-
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:
ByteBuf.readRetainedSlice(int)
-
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:
ByteBuf.copy()
-
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:
ByteBuf.copy(int, int)
-
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:
ByteBuf.slice()
-
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:
ByteBuf.retainedSlice()
-
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:
ByteBuf.slice(int, int)
-
retainedSlice
public static net.minecraft.network.PacketByteBuf retainedSlice(ByteBuf buf, int index, int length)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:
ByteBuf.retainedSlice(int, int)
-
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:
ByteBuf.duplicate()
-
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:
ByteBuf.retainedDuplicate()
-