Implement LongTag
This commit is contained in:
parent
dd133afd68
commit
4917419bd3
2 changed files with 29 additions and 20 deletions
|
@ -5,7 +5,7 @@ import 'package:libac_flutter/nbt/impl/EndTag.dart';
|
|||
import 'package:libac_flutter/nbt/impl/FloatTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/IntArrayTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/IntTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/TagLong.dart';
|
||||
import 'package:libac_flutter/nbt/impl/LongTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/TagShort.dart';
|
||||
|
||||
import 'Stream.dart';
|
||||
|
@ -76,6 +76,20 @@ abstract class Tag {
|
|||
}
|
||||
}
|
||||
|
||||
bool equals(dynamic object) {
|
||||
if (object == null || !(object is Tag)) return false;
|
||||
|
||||
Tag tag = object;
|
||||
if (tag.getType() != getType()) return false;
|
||||
|
||||
if (getKey() == null && tag.getKey() != null ||
|
||||
tag.getKey() == null && getKey() != null) return false;
|
||||
|
||||
if (getKey() != null && !(getKey() == tag.getKey())) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static Tag makeTagOfType(TagType type) {
|
||||
switch (type) {
|
||||
case TagType.Byte:
|
||||
|
@ -102,7 +116,7 @@ abstract class Tag {
|
|||
case TagType.Int:
|
||||
return new IntTag();
|
||||
case TagType.Long:
|
||||
return new TagLong(value: 0);
|
||||
return new LongTag();
|
||||
case TagType.Float:
|
||||
return new FloatTag();
|
||||
case TagType.IntArray:
|
||||
|
@ -118,17 +132,4 @@ abstract class Tag {
|
|||
}
|
||||
}
|
||||
|
||||
bool equals(dynamic object) {
|
||||
if (object == null || !(object is Tag)) return false;
|
||||
|
||||
Tag tag = object;
|
||||
if (tag.getType() != getType()) return false;
|
||||
|
||||
if (getKey() == null && tag.getKey() != null ||
|
||||
tag.getKey() == null && getKey() != null) return false;
|
||||
|
||||
if (getKey() != null && !(getKey() == tag.getKey())) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue