Continued cleanup of runtime entity NBT removal

it's no longer necessary to force-write these, since the NBT is now ephemeral. Any tag type mismatches should be dealt with on read, after which the original tag will be discarded anyway.
This commit is contained in:
Dylan K. Taylor 2018-08-15 14:50:58 +01:00
parent 30fcfac8cf
commit 2ee0436f46
5 changed files with 7 additions and 7 deletions

View File

@ -838,7 +838,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
public function saveNBT() : CompoundTag{
$nbt = new CompoundTag();
if(!($this instanceof Player)){
$nbt->setString("id", $this->getSaveId(), true);
$nbt->setString("id", $this->getSaveId());
if($this->getNameTag() !== ""){
$nbt->setString("CustomName", $this->getNameTag());

View File

@ -769,9 +769,9 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
public function saveNBT() : CompoundTag{
$nbt = parent::saveNBT();
$nbt->setInt("foodLevel", (int) $this->getFood(), true);
$nbt->setFloat("foodExhaustionLevel", $this->getExhaustion(), true);
$nbt->setFloat("foodSaturationLevel", $this->getSaturation(), true);
$nbt->setInt("foodLevel", (int) $this->getFood());
$nbt->setFloat("foodExhaustionLevel", $this->getExhaustion());
$nbt->setFloat("foodSaturationLevel", $this->getSaturation());
$nbt->setInt("foodTickTimer", $this->foodTickTimer);
$nbt->setInt("XpLevel", $this->getXpLevel());

View File

@ -148,7 +148,7 @@ abstract class Living extends Entity implements Damageable{
public function saveNBT() : CompoundTag{
$nbt = parent::saveNBT();
$nbt->setFloat("Health", $this->getHealth(), true);
$nbt->setFloat("Health", $this->getHealth());
if(count($this->effects) > 0){
$effects = [];

View File

@ -135,7 +135,7 @@ class FallingBlock extends Entity{
public function saveNBT() : CompoundTag{
$nbt = parent::saveNBT();
$nbt->setInt("TileID", $this->block->getId(), true);
$nbt->setInt("TileID", $this->block->getId());
$nbt->setByte("Data", $this->block->getDamage());
return $nbt;

View File

@ -76,7 +76,7 @@ class PrimedTNT extends Entity implements Explosive{
public function saveNBT() : CompoundTag{
$nbt = parent::saveNBT();
$nbt->setShort("Fuse", $this->fuse, true); //older versions incorrectly saved this as a byte
$nbt->setShort("Fuse", $this->fuse);
return $nbt;
}