Interface IFriendlyByteBufExtension
- All Known Implementing Classes:
 FriendlyByteBuf
public interface IFriendlyByteBufExtension
Additional helper methods for 
FriendlyByteBuf.- 
Method Summary
Modifier and TypeMethodDescriptiondefault <T> T[]readArray(IntFunction<T[]> builder, FriendlyByteBuf.Reader<T> reader) Reads an array of objects from the buffer.default FluidStackReads a FluidStack from this buffer.default ItemStackReads anItemStackfrom the current buffer, but allows for a larger count than the vanilla method, using a variable length int instead of a byte.default <K,V> Map<K, V> readMap(FriendlyByteBuf.Reader<K> keyReader, BiFunction<FriendlyByteBuf, K, V> valueReader) Variant ofFriendlyByteBuf.readMap(FriendlyByteBuf.Reader, FriendlyByteBuf.Reader)that allows reading values that depend on the key.private FriendlyByteBufself()default <T> FriendlyByteBufwriteArray(T[] array, FriendlyByteBuf.Writer<T> writer) Writes an array of objects to the buffer.default FriendlyByteBufwriteByte(byte value) Writes a byte to the bufferdefault voidwriteFluidStack(FluidStack stack) Writes a FluidStack to the packet buffer, easy enough.default FriendlyByteBufwriteItemWithLargeCount(ItemStack stack) Writes anItemStackto the current buffer, but allows for a larger count than the vanilla method, using a variable length int instead of a byte.default <K,V> void writeMap(Map<K, V> map, FriendlyByteBuf.Writer<K> keyWriter, org.apache.commons.lang3.function.TriConsumer<FriendlyByteBuf, K, V> valueWriter) Variant ofFriendlyByteBuf.writeMap(Map, FriendlyByteBuf.Writer, FriendlyByteBuf.Writer)that allows writing values that depend on the key.default <T> voidwriteObjectCollection(Collection<T> set, BiConsumer<T, FriendlyByteBuf> writer) Writes the entries in the given set to the buffer, by first writing the count and then writing each entry. 
- 
Method Details
- 
self
 - 
writeFluidStack
Writes a FluidStack to the packet buffer, easy enough. If EMPTY, writes a FALSE. This behavior provides parity with the ItemStack method in PacketBuffer.- Parameters:
 stack- FluidStack to be written to the packet buffer.
 - 
readFluidStack
Reads a FluidStack from this buffer. - 
writeObjectCollection
Writes the entries in the given set to the buffer, by first writing the count and then writing each entry.- Type Parameters:
 T- The type of the entry- Parameters:
 set- The set to writewriter- The writer to use for writing each entry- Implementation Note:
 - This is a convenience method for 
FriendlyByteBuf.writeCollection(Collection, FriendlyByteBuf.Writer), where the callback can be a method on the entry type. 
 - 
readItemWithLargeCount
Reads anItemStackfrom the current buffer, but allows for a larger count than the vanilla method, using a variable length int instead of a byte.- Returns:
 - The read stack
 
 - 
writeItemWithLargeCount
Writes anItemStackto the current buffer, but allows for a larger count than the vanilla method, using a variable length int instead of a byte.- Parameters:
 stack- The stack to write- Returns:
 - The buffer
 
 - 
readArray
Reads an array of objects from the buffer.- Type Parameters:
 T- The type of the objects- Parameters:
 builder- A function that creates an array of the given sizereader- A function that reads an object from the buffer- Returns:
 - The array of objects
 
 - 
writeArray
Writes an array of objects to the buffer.- Type Parameters:
 T- The type of the objects- Parameters:
 array- The array of objectswriter- A function that writes an object to the buffer- Returns:
 - The buffer
 
 - 
writeByte
Writes a byte to the buffer- Parameters:
 value- The value to be written- Returns:
 - The buffer
 
 - 
readMap
default <K,V> Map<K,V> readMap(FriendlyByteBuf.Reader<K> keyReader, BiFunction<FriendlyByteBuf, K, V> valueReader) Variant ofFriendlyByteBuf.readMap(FriendlyByteBuf.Reader, FriendlyByteBuf.Reader)that allows reading values that depend on the key. - 
writeMap
default <K,V> void writeMap(Map<K, V> map, FriendlyByteBuf.Writer<K> keyWriter, org.apache.commons.lang3.function.TriConsumer<FriendlyByteBuf, K, V> valueWriter) Variant ofFriendlyByteBuf.writeMap(Map, FriendlyByteBuf.Writer, FriendlyByteBuf.Writer)that allows writing values that depend on the key. 
 -