Package codechicken.lib.data
Class MCDataByteBuf
java.lang.Object
codechicken.lib.data.MCDataByteBuf
- All Implemented Interfaces:
MCDataInput,MCDataOutput
- Direct Known Subclasses:
PacketCustom
An
MCDataInput and MCDataOutput implementation,
delegating to the provided ByteBuf.
Created by covers1624 on 4/16/20.
-
Nested Class Summary
Nested classes/interfaces inherited from interface codechicken.lib.data.MCDataInput
MCDataInput.InputStreamWrapperNested classes/interfaces inherited from interface codechicken.lib.data.MCDataOutput
MCDataOutput.OutputStreamWrapper -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MCDataByteBuffromTag(net.minecraft.nbt.Tag tag) booleanReads a boolean from the stream.bytereadByte()Reads a byte from the stream.charreadChar()Reads a char from the stream.doubleReads a double from the stream.floatReads a float from the stream.static MCDataByteBufreadFromNBT(net.minecraft.nbt.CompoundTag tag, String key) intreadInt()Reads an int from the stream.longreadLong()Reads a long from the stream.shortReads a Short from the stream.shortReads an Unsigned byte from the stream.intReads an Unsigned short from the stream.net.minecraft.network.FriendlyByteBufGets the underlying buffer as aFriendlyByteBuf.net.minecraft.nbt.TagtoTag()writeBoolean(boolean b) Writes a boolean to the stream.writeByte(int b) Writes a byte to the stream.writeChar(int c) Writes a char to the stream.writeDouble(double d) Writes a double to the stream.writeFloat(float f) Writes a float to the stream.writeInt(int i) Writes a int to the stream.writeLong(long l) Writes a long to the stream.writeShort(int s) Writes a short to the stream.net.minecraft.nbt.CompoundTagwriteToNBT(net.minecraft.nbt.CompoundTag tag, String key) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface codechicken.lib.data.MCDataInput
readBooleans, readByteBuf, readByteBuffer, readBytes, readCharBuffer, readChars, readCompoundNBT, readCuboid, readDirection, readDoubleBuffer, readDoubles, readEnum, readFloatBuffer, readFloats, readFluidStack, readIntBuffer, readInts, readItemStack, readLongBuffer, readLongs, readPos, readRegistryId, readRegistryIdDirect, readResourceLocation, readShortBuffer, readShorts, readSignedVarInt, readSignedVarInts, readSignedVarLong, readSignedVarLongs, readString, readTextComponent, readUUID, readVarInt, readVarInts, readVarLong, readVarLongs, readVec3d, readVec3f, readVec3i, readVector, toDataInput, toInputStreamMethods inherited from interface codechicken.lib.data.MCDataOutput
append, append, toDataOutput, toOutputStream, writeBooleans, writeBooleans, writeByteBuf, writeByteBuffer, writeBytes, writeBytes, writeCharBuffer, writeChars, writeChars, writeCompoundNBT, writeCuboid, writeDirection, writeDoubleBuffer, writeDoubles, writeDoubles, writeEnum, writeFloatBuffer, writeFloats, writeFloats, writeFluidStack, writeIntBuffer, writeInts, writeInts, writeItemStack, writeItemStack, writeLongBuffer, writeLongs, writeLongs, writePos, writeRegistryId, writeRegistryId, writeRegistryIdDirect, writeRegistryIdDirect, writeResourceLocation, writeShortBuffer, writeShorts, writeShorts, writeSignedVarInt, writeSignedVarInts, writeSignedVarInts, writeSignedVarLong, writeSignedVarLongs, writeSignedVarLongs, writeString, writeString, writeTextComponent, writeUUID, writeVarInt, writeVarInts, writeVarInts, writeVarLong, writeVarLongs, writeVarLongs, writeVec3d, writeVec3f, writeVec3i, writeVector
-
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 aFriendlyByteBuf.- Returns:
- The
FriendlyByteBuf.
-
toTag
public net.minecraft.nbt.Tag toTag() -
fromTag
-
writeToNBT
-
readFromNBT
-
readByte
public byte readByte()Description copied from interface:MCDataInputReads a byte from the stream.- Specified by:
readBytein interfaceMCDataInput- Returns:
- The byte.
-
readUByte
public short readUByte()Description copied from interface:MCDataInputReads an Unsigned byte from the stream.- Specified by:
readUBytein interfaceMCDataInput- Returns:
- The Unsigned byte.
-
readChar
public char readChar()Description copied from interface:MCDataInputReads a char from the stream.- Specified by:
readCharin interfaceMCDataInput- Returns:
- The char.
-
readShort
public short readShort()Description copied from interface:MCDataInputReads a Short from the stream.- Specified by:
readShortin interfaceMCDataInput- Returns:
- The short.
-
readUShort
public int readUShort()Description copied from interface:MCDataInputReads an Unsigned short from the stream.- Specified by:
readUShortin interfaceMCDataInput- Returns:
- The Unsigned short.
-
readInt
public int readInt()Description copied from interface:MCDataInputReads an int from the stream.- Specified by:
readIntin interfaceMCDataInput- Returns:
- The int.
-
readLong
public long readLong()Description copied from interface:MCDataInputReads a long from the stream.- Specified by:
readLongin interfaceMCDataInput- Returns:
- The long.
-
readFloat
public float readFloat()Description copied from interface:MCDataInputReads a float from the stream.- Specified by:
readFloatin interfaceMCDataInput- Returns:
- The float.
-
readDouble
public double readDouble()Description copied from interface:MCDataInputReads a double from the stream.- Specified by:
readDoublein interfaceMCDataInput- Returns:
- The double.
-
readBoolean
public boolean readBoolean()Description copied from interface:MCDataInputReads a boolean from the stream.- Specified by:
readBooleanin interfaceMCDataInput- Returns:
- The boolean.
-
writeByte
Description copied from interface:MCDataOutputWrites a byte to the stream.- Specified by:
writeBytein interfaceMCDataOutput- Parameters:
b- The byte.- Returns:
- The same stream.
-
writeChar
Description copied from interface:MCDataOutputWrites a char to the stream.- Specified by:
writeCharin interfaceMCDataOutput- Parameters:
c- The char.- Returns:
- The same stream.
-
writeShort
Description copied from interface:MCDataOutputWrites a short to the stream.- Specified by:
writeShortin interfaceMCDataOutput- Parameters:
s- The short.- Returns:
- The same stream.
-
writeInt
Description copied from interface:MCDataOutputWrites a int to the stream.- Specified by:
writeIntin interfaceMCDataOutput- Parameters:
i- The int.- Returns:
- The same stream.
-
writeLong
Description copied from interface:MCDataOutputWrites a long to the stream.- Specified by:
writeLongin interfaceMCDataOutput- Parameters:
l- The long.- Returns:
- The same stream.
-
writeFloat
Description copied from interface:MCDataOutputWrites a float to the stream.- Specified by:
writeFloatin interfaceMCDataOutput- Parameters:
f- The float.- Returns:
- The same stream.
-
writeDouble
Description copied from interface:MCDataOutputWrites a double to the stream.- Specified by:
writeDoublein interfaceMCDataOutput- Parameters:
d- The double.- Returns:
- The same stream.
-
writeBoolean
Description copied from interface:MCDataOutputWrites a boolean to the stream.- Specified by:
writeBooleanin interfaceMCDataOutput- Parameters:
b- The boolean.- Returns:
- The same stream.
-