Class FriendlyByteBufs
java.lang.Object
net.fabricmc.fabric.api.networking.v1.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 buf frombuf.copyin a friendly byte buf.static net.minecraft.network.FriendlyByteBufcopy(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.copyin a friendly byte buf.static net.minecraft.network.FriendlyByteBufcreate()Returns a new heap memory-backed instance of friendly byte buf.static net.minecraft.network.FriendlyByteBufduplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.duplicatein a friendly byte buf.static net.minecraft.network.FriendlyByteBufempty()Returns an empty instance of friendly byte buf.static net.minecraft.network.FriendlyByteBufreadBytes(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readBytesin a friendly byte buf.static net.minecraft.network.FriendlyByteBufreadRetainedSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readRetainedSlicein a friendly byte buf.static net.minecraft.network.FriendlyByteBufreadSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readSlicein a friendly byte buf.static net.minecraft.network.FriendlyByteBufretainedDuplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedDuplicatein a friendly byte buf.static net.minecraft.network.FriendlyByteBufretainedSlice(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedSlicein a friendly byte buf.static net.minecraft.network.FriendlyByteBufretainedSlice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.retainedSlicein a friendly byte buf.static net.minecraft.network.FriendlyByteBufslice(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.slicein a friendly byte buf.static net.minecraft.network.FriendlyByteBufslice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.slicein a friendly byte buf.
-
Method Details
-
empty
public static net.minecraft.network.FriendlyByteBuf empty()Returns an empty instance of friendly byte buf.- Returns:
- an empty buf
-
create
public static net.minecraft.network.FriendlyByteBuf create()Returns a new heap memory-backed instance of friendly byte buf.- Returns:
- a new buf
-
readBytes
public static net.minecraft.network.FriendlyByteBuf readBytes(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readBytesin a friendly byte buf.- Parameters:
buf- the original buflength- the number of bytes to transfer- Returns:
- the transferred bytes
- See Also:
-
readSlice
public static net.minecraft.network.FriendlyByteBuf readSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readSlicein a friendly byte buf.- Parameters:
buf- the original buflength- the size of the new slice- Returns:
- the newly created slice
- See Also:
-
readRetainedSlice
public static net.minecraft.network.FriendlyByteBuf readRetainedSlice(io.netty.buffer.ByteBuf buf, int length) Wraps the newly created buf frombuf.readRetainedSlicein a friendly byte buf.- Parameters:
buf- the original buflength- the size of the new slice- Returns:
- the newly created slice
- See Also:
-
copy
public static net.minecraft.network.FriendlyByteBuf copy(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.copyin a friendly byte buf.- Parameters:
buf- the original buf- Returns:
- a copy of the buf
- See Also:
-
copy
public static net.minecraft.network.FriendlyByteBuf copy(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.copyin a friendly byte buf.- Parameters:
buf- the original bufindex- the starting indexlength- the size of the copy- Returns:
- a copy of the buf
- See Also:
-
slice
public static net.minecraft.network.FriendlyByteBuf slice(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.slicein a friendly byte buf.- Parameters:
buf- the original buf- Returns:
- a slice of the buf
- See Also:
-
retainedSlice
public static net.minecraft.network.FriendlyByteBuf retainedSlice(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedSlicein a friendly byte buf.- Parameters:
buf- the original buf- Returns:
- a slice of the buf
- See Also:
-
slice
public static net.minecraft.network.FriendlyByteBuf slice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.slicein a friendly byte buf.- Parameters:
buf- the original bufindex- the starting indexlength- the size of the copy- Returns:
- a slice of the buf
- See Also:
-
retainedSlice
public static net.minecraft.network.FriendlyByteBuf retainedSlice(io.netty.buffer.ByteBuf buf, int index, int length) Wraps the newly created buf frombuf.retainedSlicein a friendly byte buf.- Parameters:
buf- the original bufindex- the starting indexlength- the size of the copy- Returns:
- a slice of the buf
- See Also:
-
duplicate
public static net.minecraft.network.FriendlyByteBuf duplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.duplicatein a friendly byte buf.- Parameters:
buf- the original buf- Returns:
- a duplicate of the buf
- See Also:
-
retainedDuplicate
public static net.minecraft.network.FriendlyByteBuf retainedDuplicate(io.netty.buffer.ByteBuf buf) Wraps the newly created buf frombuf.retainedDuplicatein a friendly byte buf.- Parameters:
buf- the original buf- Returns:
- a duplicate of the buf
- See Also:
-