updated pocketmine/nbt dependency

this is going to need work on exception handling, but right now it's so inconsistent that it doesn't matter anyway.
This commit is contained in:
Dylan K. Taylor
2020-03-04 17:53:37 +00:00
parent 6e39e34c1e
commit 995309424e
16 changed files with 45 additions and 32 deletions

View File

@ -45,7 +45,7 @@ class Comparator extends Tile{
}
public function readSaveData(CompoundTag $nbt) : void{
$this->signalStrength = $nbt->getInt(self::TAG_OUTPUT_SIGNAL, 0, true);
$this->signalStrength = $nbt->getInt(self::TAG_OUTPUT_SIGNAL, 0);
}
protected function writeSaveData(CompoundTag $nbt) : void{

View File

@ -66,14 +66,14 @@ class Furnace extends Spawnable implements Container, Nameable{
}
public function readSaveData(CompoundTag $nbt) : void{
$this->remainingFuelTime = max(0, $nbt->getShort(self::TAG_BURN_TIME, $this->remainingFuelTime, true));
$this->remainingFuelTime = max(0, $nbt->getShort(self::TAG_BURN_TIME, $this->remainingFuelTime));
$this->cookTime = $nbt->getShort(self::TAG_COOK_TIME, $this->cookTime, true);
$this->cookTime = $nbt->getShort(self::TAG_COOK_TIME, $this->cookTime);
if($this->remainingFuelTime === 0){
$this->cookTime = 0;
}
$this->maxFuelTime = $nbt->getShort(self::TAG_MAX_TIME, $this->maxFuelTime, true);
$this->maxFuelTime = $nbt->getShort(self::TAG_MAX_TIME, $this->maxFuelTime);
if($this->maxFuelTime === 0){
$this->maxFuelTime = $this->remainingFuelTime;
}

View File

@ -54,8 +54,8 @@ class ItemFrame extends Spawnable{
if(($itemTag = $nbt->getCompoundTag(self::TAG_ITEM)) !== null){
$this->item = Item::nbtDeserialize($itemTag);
}
$this->itemRotation = $nbt->getByte(self::TAG_ITEM_ROTATION, $this->itemRotation, true);
$this->itemDropChance = $nbt->getFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance, true);
$this->itemRotation = $nbt->getByte(self::TAG_ITEM_ROTATION, $this->itemRotation);
$this->itemDropChance = $nbt->getFloat(self::TAG_ITEM_DROP_CHANCE, $this->itemDropChance);
}
protected function writeSaveData(CompoundTag $nbt) : void{

View File

@ -58,7 +58,7 @@ class Skull extends Spawnable{
//bad data, drop it
}
}
$rotation = $nbt->getByte(self::TAG_ROT, 0, true);
$rotation = $nbt->getByte(self::TAG_ROT, 0);
if($rotation >= 0 and $rotation <= 15){
$this->skullRotation = $rotation;
}

View File

@ -167,7 +167,7 @@ final class TileFactory{
* @internal
*/
public static function createFromData(World $world, CompoundTag $nbt) : ?Tile{
$type = $nbt->getString(Tile::TAG_ID, "", true);
$type = $nbt->getString(Tile::TAG_ID, "");
if(!isset(self::$knownTiles[$type])){
return null;
}