mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 13:25:16 +00:00
SplashPotion: const-ify missed NBT key
This commit is contained in:
parent
0c9b6a6797
commit
3d038b28ff
@ -154,7 +154,7 @@ final class EntityFactory{
|
|||||||
}, ['Snowball', 'minecraft:snowball'], LegacyIds::SNOWBALL);
|
}, ['Snowball', 'minecraft:snowball'], LegacyIds::SNOWBALL);
|
||||||
|
|
||||||
$this->register(SplashPotion::class, function(World $world, CompoundTag $nbt) : SplashPotion{
|
$this->register(SplashPotion::class, function(World $world, CompoundTag $nbt) : SplashPotion{
|
||||||
$potionType = PotionTypeIdMap::getInstance()->fromId($nbt->getShort("PotionId", PotionTypeIds::WATER));
|
$potionType = PotionTypeIdMap::getInstance()->fromId($nbt->getShort(SplashPotion::TAG_POTION_ID, PotionTypeIds::WATER));
|
||||||
if($potionType === null){
|
if($potionType === null){
|
||||||
throw new SavedDataLoadingException("No such potion type");
|
throw new SavedDataLoadingException("No such potion type");
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,8 @@ use function sqrt;
|
|||||||
|
|
||||||
class SplashPotion extends Throwable{
|
class SplashPotion extends Throwable{
|
||||||
|
|
||||||
|
public const TAG_POTION_ID = "PotionId"; //TAG_Short
|
||||||
|
|
||||||
public static function getNetworkTypeId() : string{ return EntityIds::SPLASH_POTION; }
|
public static function getNetworkTypeId() : string{ return EntityIds::SPLASH_POTION; }
|
||||||
|
|
||||||
protected $gravity = 0.05;
|
protected $gravity = 0.05;
|
||||||
@ -66,7 +68,7 @@ class SplashPotion extends Throwable{
|
|||||||
|
|
||||||
public function saveNBT() : CompoundTag{
|
public function saveNBT() : CompoundTag{
|
||||||
$nbt = parent::saveNBT();
|
$nbt = parent::saveNBT();
|
||||||
$nbt->setShort("PotionId", PotionTypeIdMap::getInstance()->toId($this->getPotionType()));
|
$nbt->setShort(self::TAG_POTION_ID, PotionTypeIdMap::getInstance()->toId($this->getPotionType()));
|
||||||
|
|
||||||
return $nbt;
|
return $nbt;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user