mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-25 20:54:56 +00:00
Fix unit tests
This commit is contained in:
parent
8f9478e82f
commit
ef53676a59
@ -27,6 +27,7 @@ use pocketmine\block\tile\Banner as TileBanner;
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\block\utils\SupportType;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\item\VanillaItems;
|
||||
use pocketmine\math\Vector3;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\world\BlockTransaction;
|
||||
@ -82,4 +83,8 @@ abstract class BaseOminousBanner extends Transparent{
|
||||
$this->position->getWorld()->useBreakOn($this->position);
|
||||
}
|
||||
}
|
||||
|
||||
public function asItem() : Item{
|
||||
return VanillaItems::OMINOUS_BANNER();
|
||||
}
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ final class ItemSerializerDeserializerRegistrar{
|
||||
$this->serializer?->map(Items::DYE(), fn(Dye $item) => new Data(DyeColorIdMap::getInstance()->toItemId($item->getColor())));
|
||||
|
||||
$this->deserializer?->map(Ids::BANNER, function(Data $data) : Item{
|
||||
$type = $data->getTag()?->getInt(TileBanner::TAG_TYPE) ?? TileBanner::TYPE_NORMAL;
|
||||
$type = $data->getTag()?->getInt(TileBanner::TAG_TYPE, TileBanner::TYPE_NORMAL) ?? TileBanner::TYPE_NORMAL;
|
||||
if($type === TileBanner::TYPE_OMINOUS){
|
||||
return Items::OMINOUS_BANNER();
|
||||
}
|
||||
|
@ -508,6 +508,8 @@
|
||||
"OAK_WALL_SIGN": 4,
|
||||
"OAK_WOOD": 6,
|
||||
"OBSIDIAN": 1,
|
||||
"OMINOUS_BANNER": 16,
|
||||
"OMINOUS_WALL_BANNER": 4,
|
||||
"ORANGE_TULIP": 1,
|
||||
"OXEYE_DAISY": 1,
|
||||
"PACKED_ICE": 1,
|
||||
@ -776,6 +778,8 @@
|
||||
"NOTE_BLOCK": "pocketmine\\block\\tile\\Note",
|
||||
"OAK_SIGN": "pocketmine\\block\\tile\\Sign",
|
||||
"OAK_WALL_SIGN": "pocketmine\\block\\tile\\Sign",
|
||||
"OMINOUS_BANNER": "pocketmine\\block\\tile\\Banner",
|
||||
"OMINOUS_WALL_BANNER": "pocketmine\\block\\tile\\Banner",
|
||||
"PALE_OAK_SIGN": "pocketmine\\block\\tile\\Sign",
|
||||
"PALE_OAK_WALL_SIGN": "pocketmine\\block\\tile\\Sign",
|
||||
"POTION_CAULDRON": "pocketmine\\block\\tile\\Cauldron",
|
||||
|
@ -59,8 +59,13 @@ final class BlockSerializerDeserializerTest extends TestCase{
|
||||
self::fail("Failed to deserialize " . $blockStateData->getName() . ": " . $e->getMessage() . " with data " . $blockStateData->toNbt());
|
||||
}
|
||||
|
||||
if($block->getTypeId() === BlockTypeIds::POTION_CAULDRON){
|
||||
//this pretends to be a water cauldron in the blockstate, and stores its actual data in the blockentity
|
||||
if(match ($block->getTypeId()) {
|
||||
BlockTypeIds::POTION_CAULDRON,
|
||||
BlockTypeIds::OMINOUS_BANNER,
|
||||
BlockTypeIds::OMINOUS_WALL_BANNER => true,
|
||||
default => false
|
||||
}){
|
||||
//these pretend to be something else in the blockstate, and the variant switching is done via block entity data
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user