Class FriendlyByteBufs
java.lang.Object
io.github.vampirestudios.vampirelib.api.FriendlyByteBufs
Helper methods for working with and creating
FriendlyByteBufs.-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.FriendlyByteBufcopy(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.copyin a packet byte buffer.static net.minecraft.network.FriendlyByteBufcopy(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buffer frombuf.copyin a packet byte buffer.static net.minecraft.network.FriendlyByteBufcreate()Returns a new heap memory-backed instance of packet byte buffer.static net.minecraft.network.FriendlyByteBufduplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.duplicatein a packet byte buffer.static net.minecraft.network.FriendlyByteBufempty()Returns an empty instance of packet byte buffer.static net.minecraft.network.FriendlyByteBufreadBytes(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readBytesin a packet byte buffer.static net.minecraft.network.FriendlyByteBufreadRetainedSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buffer frombuf.readRetainedSlicein a packet byte buffer.static net.minecraft.network.FriendlyByteBufreadSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buffer frombuf.readSlicein a packet byte buffer.static net.minecraft.network.FriendlyByteBufretainedDuplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.retainedDuplicatein a packet byte buffer.static net.minecraft.network.FriendlyByteBufretainedSlice(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.retainedSlicein a packet byte buffer.static net.minecraft.network.FriendlyByteBufretainedSlice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buffer frombuf.retainedSlicein a packet byte buffer.static net.minecraft.network.FriendlyByteBufslice(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.slicein a packet byte buffer.static net.minecraft.network.FriendlyByteBufslice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buffer frombuf.slicein a packet byte buffer.
-
Method Details
-
empty
public static net.minecraft.network.FriendlyByteBuf empty()Returns an empty instance of packet byte buffer.- Returns:
- an empty buffer
-
create
public static net.minecraft.network.FriendlyByteBuf create()Returns a new heap memory-backed instance of packet byte buffer.- Returns:
- a new buffer
-
readBytes
public static net.minecraft.network.FriendlyByteBuf readBytes(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readBytesin a packet byte buffer.- Parameters:
buf- the original bufferlength- the number of bytes to transfer- Returns:
- the transferred bytes
- See Also:
-
ByteBuf.readBytes(int)
-
readSlice
public static net.minecraft.network.FriendlyByteBuf readSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buffer frombuf.readSlicein a packet byte buffer.- Parameters:
buf- the original bufferlength- the size of the new slice- Returns:
- the newly created slice
- See Also:
-
ByteBuf.readSlice(int)
-
readRetainedSlice
public static net.minecraft.network.FriendlyByteBuf readRetainedSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buffer frombuf.readRetainedSlicein a packet byte buffer.- Parameters:
buf- the original bufferlength- the size of the new slice- Returns:
- the newly created slice
- See Also:
-
ByteBuf.readRetainedSlice(int)
-
copy
public static net.minecraft.network.FriendlyByteBuf copy(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.copyin a packet byte buffer.- Parameters:
buf- the original buffer- Returns:
- a copy of the buffer
- See Also:
-
ByteBuf.copy()
-
copy
public static net.minecraft.network.FriendlyByteBuf copy(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buffer frombuf.copyin a packet byte buffer.- Parameters:
buf- the original bufferindex- the starting indexlength- the size of the copy- Returns:
- a copy of the buffer
- See Also:
-
ByteBuf.copy(int, int)
-
slice
public static net.minecraft.network.FriendlyByteBuf slice(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.slicein a packet byte buffer.- Parameters:
buf- the original buffer- Returns:
- a slice of the buffer
- See Also:
-
ByteBuf.slice()
-
retainedSlice
public static net.minecraft.network.FriendlyByteBuf retainedSlice(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.retainedSlicein a packet byte buffer.- Parameters:
buf- the original buffer- Returns:
- a slice of the buffer
- See Also:
-
ByteBuf.retainedSlice()
-
slice
public static net.minecraft.network.FriendlyByteBuf slice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buffer frombuf.slicein a packet byte buffer.- Parameters:
buf- the original bufferindex- the starting indexlength- the size of the copy- Returns:
- a slice of the buffer
- See Also:
-
ByteBuf.slice(int, int)
-
retainedSlice
public static net.minecraft.network.FriendlyByteBuf retainedSlice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buffer frombuf.retainedSlicein a packet byte buffer.- Parameters:
buf- the original bufferindex- the starting indexlength- the size of the copy- Returns:
- a slice of the buffer
- See Also:
-
ByteBuf.retainedSlice(int, int)
-
duplicate
public static net.minecraft.network.FriendlyByteBuf duplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.duplicatein a packet byte buffer.- Parameters:
buf- the original buffer- Returns:
- a duplicate of the buffer
- See Also:
-
ByteBuf.duplicate()
-
retainedDuplicate
public static net.minecraft.network.FriendlyByteBuf retainedDuplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buffer frombuf.retainedDuplicatein a packet byte buffer.- Parameters:
buf- the original buffer- Returns:
- a duplicate of the buffer
- See Also:
-
ByteBuf.retainedDuplicate()
-