Durable: do not write Damage tag if damage is zero

fixes creative inventory getting borked to hell
This commit is contained in:
Dylan K. Taylor 2022-07-04 20:11:39 +01:00
parent 45be6e19f3
commit 59c5770cf2
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -131,6 +131,6 @@ abstract class Durable extends Item{
protected function serializeCompoundTag(CompoundTag $tag) : void{
parent::serializeCompoundTag($tag);
$this->unbreakable ? $tag->setByte("Unbreakable", 1) : $tag->removeTag("Unbreakable");
$tag->setInt("Damage", $this->damage);
$this->damage !== 0 ? $tag->setInt("Damage", $this->damage) : $tag->removeTag("Damage");
}
}