mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-21 14:52:00 +01:00
fix: correct entity opt_block_state metadata serializer
This commit is contained in:
parent
e18d7fb798
commit
fe8a230abb
@ -81,12 +81,23 @@ public final class Metadata {
|
|||||||
return new MetadataImpl.EntryImpl<>(TYPE_OPTUUID, value, NetworkBuffer.OPT_UUID);
|
return new MetadataImpl.EntryImpl<>(TYPE_OPTUUID, value, NetworkBuffer.OPT_UUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entry<Integer> BlockState(@Nullable Integer value) {
|
public static Entry<Integer> BlockState(@NotNull Integer value) {
|
||||||
return new MetadataImpl.EntryImpl<>(TYPE_BLOCKSTATE, value, NetworkBuffer.BLOCK_STATE);
|
return new MetadataImpl.EntryImpl<>(TYPE_BLOCKSTATE, value, NetworkBuffer.BLOCK_STATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entry<Integer> OptBlockState(@Nullable Integer value) {
|
public static Entry<Integer> OptBlockState(@Nullable Integer value) {
|
||||||
return new MetadataImpl.EntryImpl<>(TYPE_OPTBLOCKSTATE, value, NetworkBuffer.OPT_BLOCK_STATE);
|
return new MetadataImpl.EntryImpl<>(TYPE_OPTBLOCKSTATE, value, new NetworkBuffer.Type<>() {
|
||||||
|
@Override
|
||||||
|
public void write(@NotNull NetworkBuffer buffer, Integer value) {
|
||||||
|
buffer.write(NetworkBuffer.VAR_INT, value == null ? 0 : value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer read(@NotNull NetworkBuffer buffer) {
|
||||||
|
int value = buffer.read(NetworkBuffer.VAR_INT);
|
||||||
|
return value == 0 ? null : value;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Entry<NBT> NBT(@NotNull NBT nbt) {
|
public static Entry<NBT> NBT(@NotNull NBT nbt) {
|
||||||
|
@ -64,7 +64,6 @@ public final class NetworkBuffer {
|
|||||||
public static final Type<Component> OPT_CHAT = NetworkBufferTypeImpl.fromOptional(COMPONENT);
|
public static final Type<Component> OPT_CHAT = NetworkBufferTypeImpl.fromOptional(COMPONENT);
|
||||||
public static final Type<Point> OPT_BLOCK_POSITION = NetworkBufferTypeImpl.fromOptional(BLOCK_POSITION);
|
public static final Type<Point> OPT_BLOCK_POSITION = NetworkBufferTypeImpl.fromOptional(BLOCK_POSITION);
|
||||||
public static final Type<UUID> OPT_UUID = NetworkBufferTypeImpl.fromOptional(UUID);
|
public static final Type<UUID> OPT_UUID = NetworkBufferTypeImpl.fromOptional(UUID);
|
||||||
public static final Type<Integer> OPT_BLOCK_STATE = NetworkBufferTypeImpl.fromOptional(BLOCK_STATE);
|
|
||||||
|
|
||||||
public static final Type<Direction> DIRECTION = NetworkBufferTypeImpl.fromEnum(Direction.class);
|
public static final Type<Direction> DIRECTION = NetworkBufferTypeImpl.fromEnum(Direction.class);
|
||||||
public static final Type<Entity.Pose> POSE = NetworkBufferTypeImpl.fromEnum(Entity.Pose.class);
|
public static final Type<Entity.Pose> POSE = NetworkBufferTypeImpl.fromEnum(Entity.Pose.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user