Class MCDataByteBuf

java.lang.Object
codechicken.lib.data.MCDataByteBuf
All Implemented Interfaces:
MCDataInput, MCDataOutput
Direct Known Subclasses:
PacketCustom

public class MCDataByteBuf extends Object implements MCDataInput, MCDataOutput
An MCDataInput and MCDataOutput implementation, delegating to the provided ByteBuf.

Created by covers1624 on 4/16/20.

  • Field Details

    • buf

      protected final io.netty.buffer.ByteBuf buf
  • Constructor Details

    • MCDataByteBuf

      public MCDataByteBuf()
    • MCDataByteBuf

      public MCDataByteBuf(io.netty.buffer.ByteBuf buf)
  • Method Details

    • toPacketBuffer

      public net.minecraft.network.FriendlyByteBuf toPacketBuffer()
      Gets the underlying buffer as a FriendlyByteBuf.
      Returns:
      The FriendlyByteBuf.
    • toTag

      public net.minecraft.nbt.Tag toTag()
    • fromTag

      public static MCDataByteBuf fromTag(net.minecraft.nbt.Tag tag)
    • writeToNBT

      public net.minecraft.nbt.CompoundTag writeToNBT(net.minecraft.nbt.CompoundTag tag, String key)
    • readFromNBT

      public static MCDataByteBuf readFromNBT(net.minecraft.nbt.CompoundTag tag, String key)
    • readByte

      public byte readByte()
      Description copied from interface: MCDataInput
      Reads a byte from the stream.
      Specified by:
      readByte in interface MCDataInput
      Returns:
      The byte.
    • readUByte

      public short readUByte()
      Description copied from interface: MCDataInput
      Reads an Unsigned byte from the stream.
      Specified by:
      readUByte in interface MCDataInput
      Returns:
      The Unsigned byte.
    • readChar

      public char readChar()
      Description copied from interface: MCDataInput
      Reads a char from the stream.
      Specified by:
      readChar in interface MCDataInput
      Returns:
      The char.
    • readShort

      public short readShort()
      Description copied from interface: MCDataInput
      Reads a Short from the stream.
      Specified by:
      readShort in interface MCDataInput
      Returns:
      The short.
    • readUShort

      public int readUShort()
      Description copied from interface: MCDataInput
      Reads an Unsigned short from the stream.
      Specified by:
      readUShort in interface MCDataInput
      Returns:
      The Unsigned short.
    • readInt

      public int readInt()
      Description copied from interface: MCDataInput
      Reads an int from the stream.
      Specified by:
      readInt in interface MCDataInput
      Returns:
      The int.
    • readLong

      public long readLong()
      Description copied from interface: MCDataInput
      Reads a long from the stream.
      Specified by:
      readLong in interface MCDataInput
      Returns:
      The long.
    • readFloat

      public float readFloat()
      Description copied from interface: MCDataInput
      Reads a float from the stream.
      Specified by:
      readFloat in interface MCDataInput
      Returns:
      The float.
    • readDouble

      public double readDouble()
      Description copied from interface: MCDataInput
      Reads a double from the stream.
      Specified by:
      readDouble in interface MCDataInput
      Returns:
      The double.
    • readBoolean

      public boolean readBoolean()
      Description copied from interface: MCDataInput
      Reads a boolean from the stream.
      Specified by:
      readBoolean in interface MCDataInput
      Returns:
      The boolean.
    • writeByte

      public MCDataOutput writeByte(int b)
      Description copied from interface: MCDataOutput
      Writes a byte to the stream.
      Specified by:
      writeByte in interface MCDataOutput
      Parameters:
      b - The byte.
      Returns:
      The same stream.
    • writeChar

      public MCDataOutput writeChar(int c)
      Description copied from interface: MCDataOutput
      Writes a char to the stream.
      Specified by:
      writeChar in interface MCDataOutput
      Parameters:
      c - The char.
      Returns:
      The same stream.
    • writeShort

      public MCDataOutput writeShort(int s)
      Description copied from interface: MCDataOutput
      Writes a short to the stream.
      Specified by:
      writeShort in interface MCDataOutput
      Parameters:
      s - The short.
      Returns:
      The same stream.
    • writeInt

      public MCDataOutput writeInt(int i)
      Description copied from interface: MCDataOutput
      Writes a int to the stream.
      Specified by:
      writeInt in interface MCDataOutput
      Parameters:
      i - The int.
      Returns:
      The same stream.
    • writeLong

      public MCDataOutput writeLong(long l)
      Description copied from interface: MCDataOutput
      Writes a long to the stream.
      Specified by:
      writeLong in interface MCDataOutput
      Parameters:
      l - The long.
      Returns:
      The same stream.
    • writeFloat

      public MCDataOutput writeFloat(float f)
      Description copied from interface: MCDataOutput
      Writes a float to the stream.
      Specified by:
      writeFloat in interface MCDataOutput
      Parameters:
      f - The float.
      Returns:
      The same stream.
    • writeDouble

      public MCDataOutput writeDouble(double d)
      Description copied from interface: MCDataOutput
      Writes a double to the stream.
      Specified by:
      writeDouble in interface MCDataOutput
      Parameters:
      d - The double.
      Returns:
      The same stream.
    • writeBoolean

      public MCDataOutput writeBoolean(boolean b)
      Description copied from interface: MCDataOutput
      Writes a boolean to the stream.
      Specified by:
      writeBoolean in interface MCDataOutput
      Parameters:
      b - The boolean.
      Returns:
      The same stream.