Implement Suspicious Stew (#5224)

This commit is contained in:
IvanCraft623
2022-08-16 11:26:32 -05:00
committed by GitHub
parent 223de3ad23
commit b65e0f64f6
12 changed files with 343 additions and 2 deletions

View File

@ -37,6 +37,7 @@ use pocketmine\data\bedrock\EntityLegacyIds;
use pocketmine\data\bedrock\item\ItemTypeNames as Ids;
use pocketmine\data\bedrock\item\SavedItemData as Data;
use pocketmine\data\bedrock\PotionTypeIdMap;
use pocketmine\data\bedrock\SuspiciousStewTypeIdMap;
use pocketmine\item\Durable;
use pocketmine\item\Item;
use pocketmine\item\VanillaItems as Items;
@ -583,7 +584,14 @@ final class ItemDeserializer{
$this->map(Ids::STRING, fn() => Items::STRING());
$this->map(Ids::SUGAR, fn() => Items::SUGAR());
$this->map(Ids::SUGAR_CANE, fn() => Blocks::SUGARCANE()->asItem());
//TODO: minecraft:suspicious_stew
$this->map(Ids::SUSPICIOUS_STEW, function(Data $data) : Item{
$meta = $data->getMeta();
$suspiciousStewType = SuspiciousStewTypeIdMap::getInstance()->fromId($meta);
if($suspiciousStewType === null){
throw new ItemTypeDeserializeException("Unknown suspicious stew type ID $meta");
}
return Items::SUSPICIOUS_STEW()->setType($suspiciousStewType);
});
$this->map(Ids::SWEET_BERRIES, fn() => Items::SWEET_BERRIES());
//TODO: minecraft:tadpole_bucket
//TODO: minecraft:tadpole_spawn_egg