Implement FloatTag
This commit is contained in:
parent
61aebb03ad
commit
120328533c
2 changed files with 15 additions and 7 deletions
|
@ -1,18 +1,26 @@
|
|||
import 'package:libac_flutter/nbt/Stream.dart';
|
||||
import 'package:libac_flutter/nbt/Tag.dart';
|
||||
|
||||
class TagFloat extends Tag {
|
||||
final double value;
|
||||
TagFloat({required this.value});
|
||||
class FloatTag extends Tag {
|
||||
double _value = 0.0;
|
||||
FloatTag();
|
||||
|
||||
FloatTag._(double value) {
|
||||
_value = value;
|
||||
}
|
||||
|
||||
static FloatTag valueOf(double value) {
|
||||
return FloatTag._(value);
|
||||
}
|
||||
|
||||
@override
|
||||
void readValue(ByteLayer data) {
|
||||
// TODO: implement readValue
|
||||
_value = data.readFloat();
|
||||
}
|
||||
|
||||
@override
|
||||
void writeValue(ByteLayer data) {
|
||||
// TODO: implement writeValue
|
||||
data.writeFloat(_value);
|
||||
}
|
||||
|
||||
@override
|
Loading…
Add table
Add a link
Reference in a new issue