Type-hinted NBT tag constructors, made getValue() and setValue() more strict, fix dozens of assorted related bugs

This commit is contained in:
Dylan K. Taylor
2017-06-08 19:17:41 +01:00
parent 595e1ab52f
commit 890f72dbf2
24 changed files with 348 additions and 65 deletions

View File

@ -728,12 +728,12 @@ class Server{
}
$spawn = $this->getDefaultLevel()->getSafeSpawn();
$nbt = new CompoundTag("", [
new LongTag("firstPlayed", floor(microtime(true) * 1000)),
new LongTag("lastPlayed", floor(microtime(true) * 1000)),
new LongTag("firstPlayed", (int) (microtime(true) * 1000)),
new LongTag("lastPlayed", (int) (microtime(true) * 1000)),
new ListTag("Pos", [
new DoubleTag(0, $spawn->x),
new DoubleTag(1, $spawn->y),
new DoubleTag(2, $spawn->z)
new DoubleTag("", $spawn->x),
new DoubleTag("", $spawn->y),
new DoubleTag("", $spawn->z)
]),
new StringTag("Level", $this->getDefaultLevel()->getName()),
//new StringTag("SpawnLevel", $this->getDefaultLevel()->getName()),
@ -745,13 +745,13 @@ class Server{
new CompoundTag("Achievements", []),
new IntTag("playerGameType", $this->getGamemode()),
new ListTag("Motion", [
new DoubleTag(0, 0.0),
new DoubleTag(1, 0.0),
new DoubleTag(2, 0.0)
new DoubleTag("", 0.0),
new DoubleTag("", 0.0),
new DoubleTag("", 0.0)
]),
new ListTag("Rotation", [
new FloatTag(0, 0.0),
new FloatTag(1, 0.0)
new FloatTag("", 0.0),
new FloatTag("", 0.0)
]),
new FloatTag("FallDistance", 0.0),
new ShortTag("Fire", 0),