mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-31 21:48:08 +01:00
Removed confusing BinaryReader method
This commit is contained in:
parent
02f507d5ad
commit
a992dc1ff9
@ -18,7 +18,7 @@ public interface SerializableData extends Data {
|
|||||||
DataManager DATA_MANAGER = MinecraftServer.getDataManager();
|
DataManager DATA_MANAGER = MinecraftServer.getDataManager();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<T> void set(@NotNull String key, @Nullable T value, @NotNull Class<T> type);
|
<T> void set(@NotNull String key, @Nullable T value, @Nullable Class<T> type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes the data into an array of bytes.
|
* Serializes the data into an array of bytes.
|
||||||
@ -109,7 +109,7 @@ public interface SerializableData extends Data {
|
|||||||
{
|
{
|
||||||
final int dataIndexSize = binaryReader.readVarInt();
|
final int dataIndexSize = binaryReader.readVarInt();
|
||||||
for (int i = 0; i < dataIndexSize; i++) {
|
for (int i = 0; i < dataIndexSize; i++) {
|
||||||
final String className = binaryReader.readSizedString(Short.MAX_VALUE);
|
final String className = binaryReader.readSizedString(Integer.MAX_VALUE);
|
||||||
final short classIndex = binaryReader.readShort();
|
final short classIndex = binaryReader.readShort();
|
||||||
typeToIndexMap.put(className, classIndex);
|
typeToIndexMap.put(className, classIndex);
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ public class SerializableDataImpl extends DataImpl implements SerializableData {
|
|||||||
|
|
||||||
// Write the data (no length)
|
// Write the data (no length)
|
||||||
final DataType dataType = DATA_MANAGER.getDataType(type);
|
final DataType dataType = DATA_MANAGER.getDataType(type);
|
||||||
|
Check.notNull(dataType, "Tried to encode a type not registered in DataManager: " + type);
|
||||||
dataType.encode(binaryWriter, value);
|
dataType.encode(binaryWriter, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,12 +96,6 @@ public class BinaryReader extends InputStream {
|
|||||||
return new String(bytes);
|
return new String(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String readShortSizedString() {
|
|
||||||
final short length = readShort();
|
|
||||||
final byte[] bytes = readBytes(length);
|
|
||||||
return new String(bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] readBytes(int length) {
|
public byte[] readBytes(int length) {
|
||||||
ByteBuf buf = buffer.readBytes(length);
|
ByteBuf buf = buffer.readBytes(length);
|
||||||
byte[] bytes = new byte[buf.readableBytes()];
|
byte[] bytes = new byte[buf.readableBytes()];
|
||||||
|
Loading…
Reference in New Issue
Block a user