Implement DoubleTag
This commit is contained in:
parent
70f6e16d17
commit
0bf1e2b2d9
2 changed files with 19 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
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/TagEnd.dart';
|
||||
import 'package:libac_flutter/nbt/impl/TagFloat.dart';
|
||||
import 'package:libac_flutter/nbt/impl/TagInt.dart';
|
||||
|
@ -88,6 +89,10 @@ abstract class Tag {
|
|||
{
|
||||
return new CompoundTag();
|
||||
}
|
||||
case TagType.Double:
|
||||
{
|
||||
return new DoubleTag();
|
||||
}
|
||||
case TagType.End:
|
||||
return new TagEnd();
|
||||
case TagType.Short:
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
import 'package:libac_flutter/nbt/Stream.dart';
|
||||
import 'package:libac_flutter/nbt/Tag.dart';
|
||||
|
||||
class TagDouble extends Tag {
|
||||
final double value;
|
||||
TagDouble({required this.value});
|
||||
class DoubleTag extends Tag {
|
||||
double _value = 0.0;
|
||||
|
||||
DoubleTag();
|
||||
|
||||
DoubleTag._(double value) {
|
||||
_value = value;
|
||||
}
|
||||
|
||||
static DoubleTag valueOf(double value) {
|
||||
return DoubleTag._(value);
|
||||
}
|
||||
|
||||
@override
|
||||
void readValue(ByteLayer data) {
|
||||
// TODO: implement readValue
|
||||
_value = data.readDouble();
|
||||
}
|
||||
|
||||
@override
|
||||
void writeValue(ByteLayer data) {
|
||||
// TODO: implement writeValue
|
||||
data.writeDouble(_value);
|
||||
}
|
||||
|
||||
@override
|
Loading…
Reference in a new issue