Implement FloatTag
This commit is contained in:
parent
61aebb03ad
commit
120328533c
2 changed files with 15 additions and 7 deletions
|
@ -2,7 +2,7 @@ import 'package:libac_flutter/nbt/impl/ByteArrayTag.dart';
|
|||
import 'package:libac_flutter/nbt/impl/CompoundTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/DoubleTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/EndTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/TagFloat.dart';
|
||||
import 'package:libac_flutter/nbt/impl/FloatTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/TagInt.dart';
|
||||
import 'package:libac_flutter/nbt/impl/TagLong.dart';
|
||||
import 'package:libac_flutter/nbt/impl/TagShort.dart';
|
||||
|
@ -102,7 +102,7 @@ abstract class Tag {
|
|||
case TagType.Long:
|
||||
return new TagLong(value: 0);
|
||||
case TagType.Float:
|
||||
return new TagFloat(value: 0);
|
||||
return new FloatTag();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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…
Reference in a new issue