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
FieldsModifier and TypeFieldDescriptionprotected final io.netty.buffer.ByteBufprotected final @Nullable net.minecraft.core.RegistryAccess -
Constructor Summary
ConstructorsConstructorDescriptionMCDataByteBuf(io.netty.buffer.ByteBuf buf) MCDataByteBuf(io.netty.buffer.ByteBuf buf, @Nullable net.minecraft.core.RegistryAccess registryAccess) MCDataByteBuf(@Nullable net.minecraft.core.RegistryAccess registryAccess) -
Method Summary
Modifier and TypeMethodDescriptionstatic MCDataByteBuffromTag(net.minecraft.nbt.Tag tag, net.minecraft.core.RegistryAccess registries) 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, net.minecraft.core.RegistryAccess registries) 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.<T> TreadWithCodec(net.minecraft.network.codec.StreamDecoder<? super net.minecraft.network.FriendlyByteBuf, T> codec) <T> TreadWithRegistryCodec(net.minecraft.network.codec.StreamDecoder<? super net.minecraft.network.RegistryFriendlyByteBuf, T> codec) net.minecraft.network.FriendlyByteBufGets the underlying buffer as aFriendlyByteBuf.net.minecraft.network.RegistryFriendlyByteBufnet.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) <T> MCDataOutputwriteWithCodec(net.minecraft.network.codec.StreamEncoder<? super net.minecraft.network.FriendlyByteBuf, T> codec, T thing) <T> MCDataOutputwriteWithRegistryCodec(net.minecraft.network.codec.StreamEncoder<? super net.minecraft.network.RegistryFriendlyByteBuf, T> codec, T thing) 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, readNullableCompoundNBT, 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, writeLongBuffer, writeLongs, writeLongs, writeNullableCompoundNBT, 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 -
registryAccess
@Nullable protected final @Nullable net.minecraft.core.RegistryAccess registryAccess
-
-
Constructor Details
-
MCDataByteBuf
public MCDataByteBuf() -
MCDataByteBuf
public MCDataByteBuf(@Nullable @Nullable net.minecraft.core.RegistryAccess registryAccess) -
MCDataByteBuf
public MCDataByteBuf(io.netty.buffer.ByteBuf buf) -
MCDataByteBuf
public MCDataByteBuf(io.netty.buffer.ByteBuf buf, @Nullable @Nullable net.minecraft.core.RegistryAccess registryAccess)
-
-
Method Details
-
toFriendlyByteBuf
public net.minecraft.network.FriendlyByteBuf toFriendlyByteBuf()Gets the underlying buffer as aFriendlyByteBuf.- Returns:
- The
FriendlyByteBuf.
-
toRegistryFriendlyByteBuf
public net.minecraft.network.RegistryFriendlyByteBuf toRegistryFriendlyByteBuf() -
toTag
public net.minecraft.nbt.Tag toTag() -
fromTag
public static MCDataByteBuf fromTag(net.minecraft.nbt.Tag tag, net.minecraft.core.RegistryAccess registries) -
writeToNBT
-
readFromNBT
public static MCDataByteBuf readFromNBT(net.minecraft.nbt.CompoundTag tag, String key, net.minecraft.core.RegistryAccess registries) -
writeWithCodec
public <T> MCDataOutput writeWithCodec(net.minecraft.network.codec.StreamEncoder<? super net.minecraft.network.FriendlyByteBuf, T> codec, T thing) - Specified by:
writeWithCodecin interfaceMCDataOutput
-
writeWithRegistryCodec
public <T> MCDataOutput writeWithRegistryCodec(net.minecraft.network.codec.StreamEncoder<? super net.minecraft.network.RegistryFriendlyByteBuf, T> codec, T thing) - Specified by:
writeWithRegistryCodecin interfaceMCDataOutput
-
readWithCodec
public <T> T readWithCodec(net.minecraft.network.codec.StreamDecoder<? super net.minecraft.network.FriendlyByteBuf, T> codec) - Specified by:
readWithCodecin interfaceMCDataInput
-
readWithRegistryCodec
public <T> T readWithRegistryCodec(net.minecraft.network.codec.StreamDecoder<? super net.minecraft.network.RegistryFriendlyByteBuf, T> codec) - Specified by:
readWithRegistryCodecin interfaceMCDataInput
-
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.
-