Consistently use 'mob head' terminology in the API

previously, we were sometimes using 'mob head' and other times 'skull', sometimes even within the same file.
This commit is contained in:
Dylan K. Taylor 2023-05-26 14:52:28 +01:00
parent edafe9d21f
commit bdb0ed0701
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
15 changed files with 107 additions and 107 deletions

View File

@ -30,8 +30,8 @@ use pocketmine\block\utils\DirtType;
use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\FroglightType;
use pocketmine\block\utils\LeverFacing;
use pocketmine\block\utils\MobHeadType;
use pocketmine\block\utils\MushroomBlockType;
use pocketmine\block\utils\SkullType;
use pocketmine\block\utils\SlabType;
use pocketmine\item\MedicineType;
use pocketmine\item\PotionType;
@ -150,7 +150,7 @@ $enumsUsed = [
LeverFacing::getAll(),
MedicineType::getAll(),
MushroomBlockType::getAll(),
SkullType::getAll(),
MobHeadType::getAll(),
SlabType::getAll(),
SuspiciousStewType::getAll(),
PotionType::getAll()

View File

@ -23,8 +23,8 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\tile\Skull as TileSkull;
use pocketmine\block\utils\SkullType;
use pocketmine\block\tile\MobHead as TileMobHead;
use pocketmine\block\utils\MobHeadType;
use pocketmine\data\runtime\RuntimeDataDescriber;
use pocketmine\item\Item;
use pocketmine\math\AxisAlignedBB;
@ -35,22 +35,22 @@ use pocketmine\world\BlockTransaction;
use function assert;
use function floor;
class Skull extends Flowable{
class MobHead extends Flowable{
public const MIN_ROTATION = 0;
public const MAX_ROTATION = 15;
protected SkullType $skullType;
protected MobHeadType $mobHeadType;
protected int $facing = Facing::NORTH;
protected int $rotation = self::MIN_ROTATION; //TODO: split this into floor skull and wall skull handling
public function __construct(BlockIdentifier $idInfo, string $name, BlockTypeInfo $typeInfo){
$this->skullType = SkullType::SKELETON(); //TODO: this should be a parameter
$this->mobHeadType = MobHeadType::SKELETON(); //TODO: this should be a parameter
parent::__construct($idInfo, $name, $typeInfo);
}
public function describeBlockItemState(RuntimeDataDescriber $w) : void{
$w->skullType($this->skullType);
$w->mobHeadType($this->mobHeadType);
}
protected function describeBlockOnlyState(RuntimeDataDescriber $w) : void{
@ -60,8 +60,8 @@ class Skull extends Flowable{
public function readStateFromWorld() : Block{
parent::readStateFromWorld();
$tile = $this->position->getWorld()->getTile($this->position);
if($tile instanceof TileSkull){
$this->skullType = $tile->getSkullType();
if($tile instanceof TileMobHead){
$this->mobHeadType = $tile->getMobHeadType();
$this->rotation = $tile->getRotation();
}
@ -72,18 +72,18 @@ class Skull extends Flowable{
parent::writeStateToWorld();
//extra block properties storage hack
$tile = $this->position->getWorld()->getTile($this->position);
assert($tile instanceof TileSkull);
assert($tile instanceof TileMobHead);
$tile->setRotation($this->rotation);
$tile->setSkullType($this->skullType);
$tile->setMobHeadType($this->mobHeadType);
}
public function getSkullType() : SkullType{
return $this->skullType;
public function getMobHeadType() : MobHeadType{
return $this->mobHeadType;
}
/** @return $this */
public function setSkullType(SkullType $skullType) : self{
$this->skullType = $skullType;
public function setMobHeadType(MobHeadType $mobHeadType) : self{
$this->mobHeadType = $mobHeadType;
return $this;
}

View File

@ -48,11 +48,11 @@ use pocketmine\block\tile\Hopper as TileHopper;
use pocketmine\block\tile\ItemFrame as TileItemFrame;
use pocketmine\block\tile\Jukebox as TileJukebox;
use pocketmine\block\tile\Lectern as TileLectern;
use pocketmine\block\tile\MobHead as TileMobHead;
use pocketmine\block\tile\MonsterSpawner as TileMonsterSpawner;
use pocketmine\block\tile\NormalFurnace as TileNormalFurnace;
use pocketmine\block\tile\Note as TileNote;
use pocketmine\block\tile\ShulkerBox as TileShulkerBox;
use pocketmine\block\tile\Skull as TileSkull;
use pocketmine\block\tile\Smoker as TileSmoker;
use pocketmine\block\utils\LeavesType;
use pocketmine\block\utils\SaplingType;
@ -503,7 +503,7 @@ use function mb_strtolower;
* @method static ChemistryTable MATERIAL_REDUCER()
* @method static Melon MELON()
* @method static MelonStem MELON_STEM()
* @method static Skull MOB_HEAD()
* @method static MobHead MOB_HEAD()
* @method static MonsterSpawner MONSTER_SPAWNER()
* @method static Opaque MOSSY_COBBLESTONE()
* @method static Slab MOSSY_COBBLESTONE_SLAB()
@ -981,7 +981,7 @@ final class VanillaBlocks{
self::register("sea_lantern", new SeaLantern(new BID(Ids::SEA_LANTERN), "Sea Lantern", new Info(new BreakInfo(0.3))));
self::register("sea_pickle", new SeaPickle(new BID(Ids::SEA_PICKLE), "Sea Pickle", new Info(BreakInfo::instant())));
self::register("mob_head", new Skull(new BID(Ids::MOB_HEAD, TileSkull::class), "Mob Head", new Info(new BreakInfo(1.0))));
self::register("mob_head", new MobHead(new BID(Ids::MOB_HEAD, TileMobHead::class), "Mob Head", new Info(new BreakInfo(1.0))));
self::register("slime", new Slime(new BID(Ids::SLIME), "Slime Block", new Info(BreakInfo::instant())));
self::register("snow", new Snow(new BID(Ids::SNOW), "Snow Block", new Info(BreakInfo::shovel(0.2, ToolTier::WOOD()))));
self::register("snow_layer", new SnowLayer(new BID(Ids::SNOW_LAYER), "Snow Layer", new Info(BreakInfo::shovel(0.1, ToolTier::WOOD()))));

View File

@ -23,7 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block\tile;
use pocketmine\block\utils\SkullType;
use pocketmine\block\utils\MobHeadType;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\ByteTag;
use pocketmine\nbt\tag\CompoundTag;
@ -31,60 +31,60 @@ use pocketmine\world\World;
/**
* @deprecated
* @see \pocketmine\block\Skull
* @see \pocketmine\block\MobHead
*/
class Skull extends Spawnable{
class MobHead extends Spawnable{
private const TAG_SKULL_TYPE = "SkullType"; //TAG_Byte
private const TAG_ROT = "Rot"; //TAG_Byte
private const TAG_MOUTH_MOVING = "MouthMoving"; //TAG_Byte
private const TAG_MOUTH_TICK_COUNT = "MouthTickCount"; //TAG_Int
private SkullType $skullType;
private int $skullRotation = 0;
private MobHeadType $mobHeadType;
private int $rotation = 0;
public function __construct(World $world, Vector3 $pos){
$this->skullType = SkullType::SKELETON();
$this->mobHeadType = MobHeadType::SKELETON();
parent::__construct($world, $pos);
}
public function readSaveData(CompoundTag $nbt) : void{
if(($skullTypeTag = $nbt->getTag(self::TAG_SKULL_TYPE)) instanceof ByteTag){
try{
$this->skullType = SkullType::fromMagicNumber($skullTypeTag->getValue());
$this->mobHeadType = MobHeadType::fromMagicNumber($skullTypeTag->getValue());
}catch(\InvalidArgumentException $e){
//bad data, drop it
}
}
$rotation = $nbt->getByte(self::TAG_ROT, 0);
if($rotation >= 0 && $rotation <= 15){
$this->skullRotation = $rotation;
$this->rotation = $rotation;
}
}
protected function writeSaveData(CompoundTag $nbt) : void{
$nbt->setByte(self::TAG_SKULL_TYPE, $this->skullType->getMagicNumber());
$nbt->setByte(self::TAG_ROT, $this->skullRotation);
$nbt->setByte(self::TAG_SKULL_TYPE, $this->mobHeadType->getMagicNumber());
$nbt->setByte(self::TAG_ROT, $this->rotation);
}
public function setSkullType(SkullType $type) : void{
$this->skullType = $type;
public function setMobHeadType(MobHeadType $type) : void{
$this->mobHeadType = $type;
}
public function getSkullType() : SkullType{
return $this->skullType;
public function getMobHeadType() : MobHeadType{
return $this->mobHeadType;
}
public function getRotation() : int{
return $this->skullRotation;
return $this->rotation;
}
public function setRotation(int $rotation) : void{
$this->skullRotation = $rotation;
$this->rotation = $rotation;
}
protected function addAdditionalSpawnData(CompoundTag $nbt) : void{
$nbt->setByte(self::TAG_SKULL_TYPE, $this->skullType->getMagicNumber());
$nbt->setByte(self::TAG_ROT, $this->skullRotation);
$nbt->setByte(self::TAG_SKULL_TYPE, $this->mobHeadType->getMagicNumber());
$nbt->setByte(self::TAG_ROT, $this->rotation);
}
}

View File

@ -75,7 +75,7 @@ final class TileFactory{
$this->register(Sign::class, ["Sign", "minecraft:sign"]);
$this->register(Smoker::class, ["Smoker", "minecraft:smoker"]);
$this->register(SporeBlossom::class, ["SporeBlossom", "minecraft:spore_blossom"]);
$this->register(Skull::class, ["Skull", "minecraft:skull"]);
$this->register(MobHead::class, ["Skull", "minecraft:skull"]);
$this->register(GlowingItemFrame::class, ["GlowItemFrame"]);
//TODO: Campfire

View File

@ -31,34 +31,34 @@ use pocketmine\utils\EnumTrait;
* @see build/generate-registry-annotations.php
* @generate-registry-docblock
*
* @method static SkullType CREEPER()
* @method static SkullType DRAGON()
* @method static SkullType PLAYER()
* @method static SkullType SKELETON()
* @method static SkullType WITHER_SKELETON()
* @method static SkullType ZOMBIE()
* @method static MobHeadType CREEPER()
* @method static MobHeadType DRAGON()
* @method static MobHeadType PLAYER()
* @method static MobHeadType SKELETON()
* @method static MobHeadType WITHER_SKELETON()
* @method static MobHeadType ZOMBIE()
*/
final class SkullType{
final class MobHeadType{
use EnumTrait {
register as Enum_register;
__construct as Enum___construct;
}
/** @var SkullType[] */
/** @var MobHeadType[] */
private static array $numericIdMap = [];
protected static function setup() : void{
self::registerAll(
new SkullType("skeleton", "Skeleton Skull", 0),
new SkullType("wither_skeleton", "Wither Skeleton Skull", 1),
new SkullType("zombie", "Zombie Head", 2),
new SkullType("player", "Player Head", 3),
new SkullType("creeper", "Creeper Head", 4),
new SkullType("dragon", "Dragon Head", 5)
new MobHeadType("skeleton", "Skeleton Skull", 0),
new MobHeadType("wither_skeleton", "Wither Skeleton Skull", 1),
new MobHeadType("zombie", "Zombie Head", 2),
new MobHeadType("player", "Player Head", 3),
new MobHeadType("creeper", "Creeper Head", 4),
new MobHeadType("dragon", "Dragon Head", 5)
);
}
protected static function register(SkullType $type) : void{
protected static function register(MobHeadType $type) : void{
self::Enum_register($type);
self::$numericIdMap[$type->getMagicNumber()] = $type;
}
@ -68,7 +68,7 @@ final class SkullType{
*
* @throws \InvalidArgumentException
*/
public static function fromMagicNumber(int $magicNumber) : SkullType{
public static function fromMagicNumber(int $magicNumber) : MobHeadType{
if(!isset(self::$numericIdMap[$magicNumber])){
throw new \InvalidArgumentException("Unknown skull type magic number $magicNumber");
}

View File

@ -93,6 +93,7 @@ use pocketmine\block\LightningRod;
use pocketmine\block\LitPumpkin;
use pocketmine\block\Loom;
use pocketmine\block\MelonStem;
use pocketmine\block\MobHead;
use pocketmine\block\NetherPortal;
use pocketmine\block\NetherVines;
use pocketmine\block\NetherWartPlant;
@ -112,7 +113,6 @@ use pocketmine\block\Sapling;
use pocketmine\block\SeaPickle;
use pocketmine\block\SimplePillar;
use pocketmine\block\SimplePressurePlate;
use pocketmine\block\Skull;
use pocketmine\block\Slab;
use pocketmine\block\SnowLayer;
use pocketmine\block\Sponge;
@ -1148,7 +1148,7 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
});
$this->map(Blocks::MATERIAL_REDUCER(), fn(ChemistryTable $block) => Helper::encodeChemistryTable($block, StringValues::CHEMISTRY_TABLE_TYPE_MATERIAL_REDUCER, new Writer(Ids::CHEMISTRY_TABLE)));
$this->map(Blocks::MELON_STEM(), fn(MelonStem $block) => Helper::encodeStem($block, new Writer(Ids::MELON_STEM)));
$this->map(Blocks::MOB_HEAD(), function(Skull $block) : Writer{
$this->map(Blocks::MOB_HEAD(), function(MobHead $block) : Writer{
return Writer::create(Ids::SKULL)
->writeFacingWithoutDown($block->getFacing());
});

View File

@ -25,9 +25,9 @@ namespace pocketmine\data\bedrock\item;
use pocketmine\block\Bed;
use pocketmine\block\Block;
use pocketmine\block\Skull;
use pocketmine\block\MobHead;
use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\SkullType;
use pocketmine\block\utils\MobHeadType;
use pocketmine\block\VanillaBlocks as Blocks;
use pocketmine\data\bedrock\CompoundTypeIds;
use pocketmine\data\bedrock\DyeColorIdMap;
@ -444,15 +444,15 @@ final class ItemSerializerDeserializerRegistrar{
$this->map1to1BlockWithMeta(
Ids::SKULL,
Blocks::MOB_HEAD(),
function(Skull $block, int $meta) : void{
function(MobHead $block, int $meta) : void{
try{
$skullType = SkullType::fromMagicNumber($meta);
$skullType = MobHeadType::fromMagicNumber($meta);
}catch(\InvalidArgumentException $e){
throw new ItemTypeDeserializeException($e->getMessage(), 0, $e);
}
$block->setSkullType($skullType);
$block->setMobHeadType($skullType);
},
fn(Skull $block) => $block->getSkullType()->getMagicNumber()
fn(MobHead $block) => $block->getMobHeadType()->getMagicNumber()
);
}

View File

@ -45,12 +45,12 @@ interface RuntimeEnumDescriber{
public function medicineType(\pocketmine\item\MedicineType &$value) : void;
public function mobHeadType(\pocketmine\block\utils\MobHeadType &$value) : void;
public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType &$value) : void;
public function potionType(\pocketmine\item\PotionType &$value) : void;
public function skullType(\pocketmine\block\utils\SkullType &$value) : void;
public function slabType(\pocketmine\block\utils\SlabType &$value) : void;
public function suspiciousStewType(\pocketmine\item\SuspiciousStewType &$value) : void;

View File

@ -126,6 +126,18 @@ trait RuntimeEnumDeserializerTrait{
};
}
public function mobHeadType(\pocketmine\block\utils\MobHeadType &$value) : void{
$value = match($this->readInt(3)){
0 => \pocketmine\block\utils\MobHeadType::CREEPER(),
1 => \pocketmine\block\utils\MobHeadType::DRAGON(),
2 => \pocketmine\block\utils\MobHeadType::PLAYER(),
3 => \pocketmine\block\utils\MobHeadType::SKELETON(),
4 => \pocketmine\block\utils\MobHeadType::WITHER_SKELETON(),
5 => \pocketmine\block\utils\MobHeadType::ZOMBIE(),
default => throw new InvalidSerializedRuntimeDataException("Invalid serialized value for MobHeadType")
};
}
public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType &$value) : void{
$value = match($this->readInt(4)){
0 => \pocketmine\block\utils\MushroomBlockType::ALL_CAP(),
@ -191,18 +203,6 @@ trait RuntimeEnumDeserializerTrait{
};
}
public function skullType(\pocketmine\block\utils\SkullType &$value) : void{
$value = match($this->readInt(3)){
0 => \pocketmine\block\utils\SkullType::CREEPER(),
1 => \pocketmine\block\utils\SkullType::DRAGON(),
2 => \pocketmine\block\utils\SkullType::PLAYER(),
3 => \pocketmine\block\utils\SkullType::SKELETON(),
4 => \pocketmine\block\utils\SkullType::WITHER_SKELETON(),
5 => \pocketmine\block\utils\SkullType::ZOMBIE(),
default => throw new InvalidSerializedRuntimeDataException("Invalid serialized value for SkullType")
};
}
public function slabType(\pocketmine\block\utils\SlabType &$value) : void{
$value = match($this->readInt(2)){
0 => \pocketmine\block\utils\SlabType::BOTTOM(),

View File

@ -126,6 +126,18 @@ trait RuntimeEnumSerializerTrait{
});
}
public function mobHeadType(\pocketmine\block\utils\MobHeadType &$value) : void{
$this->writeInt(3, match($value){
\pocketmine\block\utils\MobHeadType::CREEPER() => 0,
\pocketmine\block\utils\MobHeadType::DRAGON() => 1,
\pocketmine\block\utils\MobHeadType::PLAYER() => 2,
\pocketmine\block\utils\MobHeadType::SKELETON() => 3,
\pocketmine\block\utils\MobHeadType::WITHER_SKELETON() => 4,
\pocketmine\block\utils\MobHeadType::ZOMBIE() => 5,
default => throw new \pocketmine\utils\AssumptionFailedError("All MobHeadType cases should be covered")
});
}
public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType &$value) : void{
$this->writeInt(4, match($value){
\pocketmine\block\utils\MushroomBlockType::ALL_CAP() => 0,
@ -191,18 +203,6 @@ trait RuntimeEnumSerializerTrait{
});
}
public function skullType(\pocketmine\block\utils\SkullType &$value) : void{
$this->writeInt(3, match($value){
\pocketmine\block\utils\SkullType::CREEPER() => 0,
\pocketmine\block\utils\SkullType::DRAGON() => 1,
\pocketmine\block\utils\SkullType::PLAYER() => 2,
\pocketmine\block\utils\SkullType::SKELETON() => 3,
\pocketmine\block\utils\SkullType::WITHER_SKELETON() => 4,
\pocketmine\block\utils\SkullType::ZOMBIE() => 5,
default => throw new \pocketmine\utils\AssumptionFailedError("All SkullType cases should be covered")
});
}
public function slabType(\pocketmine\block\utils\SlabType &$value) : void{
$this->writeInt(2, match($value){
\pocketmine\block\utils\SlabType::BOTTOM() => 0,

View File

@ -63,6 +63,10 @@ trait RuntimeEnumSizeCalculatorTrait{
$this->addBits(2);
}
public function mobHeadType(\pocketmine\block\utils\MobHeadType &$value) : void{
$this->addBits(3);
}
public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType &$value) : void{
$this->addBits(4);
}
@ -71,10 +75,6 @@ trait RuntimeEnumSizeCalculatorTrait{
$this->addBits(6);
}
public function skullType(\pocketmine\block\utils\SkullType &$value) : void{
$this->addBits(3);
}
public function slabType(\pocketmine\block\utils\SlabType &$value) : void{
$this->addBits(2);
}

View File

@ -30,7 +30,7 @@ use pocketmine\block\utils\CoralType;
use pocketmine\block\utils\DirtType;
use pocketmine\block\utils\DyeColor;
use pocketmine\block\utils\FroglightType;
use pocketmine\block\utils\SkullType;
use pocketmine\block\utils\MobHeadType;
use pocketmine\block\utils\SlabType;
use pocketmine\block\VanillaBlocks as Blocks;
use pocketmine\item\VanillaItems as Items;
@ -264,7 +264,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("cracked_polished_blackstone_bricks", fn() => Blocks::CRACKED_POLISHED_BLACKSTONE_BRICKS());
$result->registerBlock("cracked_stone_bricks", fn() => Blocks::CRACKED_STONE_BRICKS());
$result->registerBlock("crafting_table", fn() => Blocks::CRAFTING_TABLE());
$result->registerBlock("creeper_head", fn() => Blocks::MOB_HEAD()->setSkullType(SkullType::CREEPER()));
$result->registerBlock("creeper_head", fn() => Blocks::MOB_HEAD()->setMobHeadType(MobHeadType::CREEPER()));
$result->registerBlock("crimson_button", fn() => Blocks::CRIMSON_BUTTON());
$result->registerBlock("crimson_door", fn() => Blocks::CRIMSON_DOOR());
$result->registerBlock("crimson_fence", fn() => Blocks::CRIMSON_FENCE());
@ -356,7 +356,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("double_wooden_slab", fn() => Blocks::OAK_SLAB()->setSlabType(SlabType::DOUBLE()));
$result->registerBlock("double_wooden_slabs", fn() => Blocks::OAK_SLAB()->setSlabType(SlabType::DOUBLE()));
$result->registerBlock("dragon_egg", fn() => Blocks::DRAGON_EGG());
$result->registerBlock("dragon_head", fn() => Blocks::MOB_HEAD()->setSkullType(SkullType::DRAGON()));
$result->registerBlock("dragon_head", fn() => Blocks::MOB_HEAD()->setMobHeadType(MobHeadType::DRAGON()));
$result->registerBlock("dried_kelp_block", fn() => Blocks::DRIED_KELP());
$result->registerBlock("dyed_shulker_box", fn() => Blocks::DYED_SHULKER_BOX());
$result->registerBlock("element_0", fn() => Blocks::ELEMENT_ZERO());
@ -844,7 +844,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("pink_tulip", fn() => Blocks::PINK_TULIP());
$result->registerBlock("plank", fn() => Blocks::OAK_PLANKS());
$result->registerBlock("planks", fn() => Blocks::OAK_PLANKS());
$result->registerBlock("player_head", fn() => Blocks::MOB_HEAD()->setSkullType(SkullType::PLAYER()));
$result->registerBlock("player_head", fn() => Blocks::MOB_HEAD()->setMobHeadType(MobHeadType::PLAYER()));
$result->registerBlock("podzol", fn() => Blocks::PODZOL());
$result->registerBlock("polished_andesite", fn() => Blocks::POLISHED_ANDESITE());
$result->registerBlock("polished_andesite_slab", fn() => Blocks::POLISHED_ANDESITE_SLAB());
@ -950,8 +950,8 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("shulker_box", fn() => Blocks::SHULKER_BOX());
$result->registerBlock("sign", fn() => Blocks::OAK_SIGN());
$result->registerBlock("sign_post", fn() => Blocks::OAK_SIGN());
$result->registerBlock("skeleton_skull", fn() => Blocks::MOB_HEAD()->setSkullType(SkullType::SKELETON()));
$result->registerBlock("skull", fn() => Blocks::MOB_HEAD()->setSkullType(SkullType::SKELETON()));
$result->registerBlock("skeleton_skull", fn() => Blocks::MOB_HEAD()->setMobHeadType(MobHeadType::SKELETON()));
$result->registerBlock("skull", fn() => Blocks::MOB_HEAD()->setMobHeadType(MobHeadType::SKELETON()));
$result->registerBlock("skull_block", fn() => Blocks::MOB_HEAD());
$result->registerBlock("slab", fn() => Blocks::SMOOTH_STONE_SLAB());
$result->registerBlock("slabs", fn() => Blocks::SMOOTH_STONE_SLAB());
@ -1100,7 +1100,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("wheat_block", fn() => Blocks::WHEAT());
$result->registerBlock("white_tulip", fn() => Blocks::WHITE_TULIP());
$result->registerBlock("wither_rose", fn() => Blocks::WITHER_ROSE());
$result->registerBlock("wither_skeleton_skull", fn() => Blocks::MOB_HEAD()->setSkullType(SkullType::WITHER_SKELETON()));
$result->registerBlock("wither_skeleton_skull", fn() => Blocks::MOB_HEAD()->setMobHeadType(MobHeadType::WITHER_SKELETON()));
$result->registerBlock("wood", fn() => Blocks::OAK_LOG()->setStripped(false));
$result->registerBlock("wood2", fn() => Blocks::ACACIA_LOG()->setStripped(false));
$result->registerBlock("wood_door_block", fn() => Blocks::OAK_DOOR());
@ -1120,7 +1120,7 @@ final class StringToItemParser extends StringToTParser{
$result->registerBlock("wool", fn() => Blocks::WOOL());
$result->registerBlock("workbench", fn() => Blocks::CRAFTING_TABLE());
$result->registerBlock("yellow_flower", fn() => Blocks::DANDELION());
$result->registerBlock("zombie_head", fn() => Blocks::MOB_HEAD()->setSkullType(SkullType::ZOMBIE()));
$result->registerBlock("zombie_head", fn() => Blocks::MOB_HEAD()->setMobHeadType(MobHeadType::ZOMBIE()));
}
private static function registerDynamicItems(self $result) : void{

View File

@ -426,14 +426,14 @@ parameters:
path: ../../../src/block/tile/Chest.php
-
message: "#^Constant pocketmine\\\\block\\\\tile\\\\Skull\\:\\:TAG_MOUTH_MOVING is unused\\.$#"
message: "#^Constant pocketmine\\\\block\\\\tile\\\\MobHead\\:\\:TAG_MOUTH_MOVING is unused\\.$#"
count: 1
path: ../../../src/block/tile/Skull.php
path: ../../../src/block/tile/MobHead.php
-
message: "#^Constant pocketmine\\\\block\\\\tile\\\\Skull\\:\\:TAG_MOUTH_TICK_COUNT is unused\\.$#"
message: "#^Constant pocketmine\\\\block\\\\tile\\\\MobHead\\:\\:TAG_MOUTH_TICK_COUNT is unused\\.$#"
count: 1
path: ../../../src/block/tile/Skull.php
path: ../../../src/block/tile/MobHead.php
-
message: "#^Parameter \\#2 \\$value of method pocketmine\\\\nbt\\\\tag\\\\CompoundTag\\:\\:setInt\\(\\) expects int, float\\|int given\\.$#"

View File

@ -28,8 +28,8 @@ use pocketmine\block\BaseBanner;
use pocketmine\block\Bed;
use pocketmine\block\BlockTypeIds;
use pocketmine\block\CaveVines;
use pocketmine\block\MobHead;
use pocketmine\block\RuntimeBlockStateRegistry;
use pocketmine\block\Skull;
use pocketmine\data\bedrock\block\BlockStateDeserializeException;
use pocketmine\data\bedrock\block\BlockStateSerializeException;
use function print_r;
@ -72,8 +72,8 @@ final class BlockSerializerDeserializerTest extends TestCase{
($block instanceof Bed && $newBlock instanceof Bed)
){
$newBlock->setColor($block->getColor());
}elseif($block instanceof Skull && $newBlock instanceof Skull){
$newBlock->setSkullType($block->getSkullType());
}elseif($block instanceof MobHead && $newBlock instanceof MobHead){
$newBlock->setMobHeadType($block->getMobHeadType());
}elseif($block instanceof CaveVines && $newBlock instanceof CaveVines && !$block->hasBerries()){
$newBlock->setHead($block->isHead());
}