mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Fixed glowing item frames
due to technical limitations, this requires separating them back into two different block types. However, this isn't too egregious since it's just one flag, and actually simplifies some code. closes #5478
This commit is contained in:
@ -25,7 +25,6 @@ namespace pocketmine\data\bedrock\item;
|
||||
|
||||
use pocketmine\block\Bed;
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\ItemFrame;
|
||||
use pocketmine\block\Skull;
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\block\utils\SkullType;
|
||||
@ -57,7 +56,6 @@ final class ItemSerializerDeserializerRegistrar{
|
||||
$this->register1to1BlockWithMetaMappings();
|
||||
$this->register1to1ItemWithMetaMappings();
|
||||
$this->register1ToNItemMappings();
|
||||
$this->registerMiscBlockMappings();
|
||||
$this->registerMiscItemMappings();
|
||||
}
|
||||
|
||||
@ -141,6 +139,8 @@ final class ItemSerializerDeserializerRegistrar{
|
||||
$this->map1to1Block(Ids::CRIMSON_DOOR, Blocks::CRIMSON_DOOR());
|
||||
$this->map1to1Block(Ids::DARK_OAK_DOOR, Blocks::DARK_OAK_DOOR());
|
||||
$this->map1to1Block(Ids::FLOWER_POT, Blocks::FLOWER_POT());
|
||||
$this->map1to1Block(Ids::FRAME, Blocks::ITEM_FRAME());
|
||||
$this->map1to1Block(Ids::GLOW_FRAME, Blocks::GLOWING_ITEM_FRAME());
|
||||
$this->map1to1Block(Ids::HOPPER, Blocks::HOPPER());
|
||||
$this->map1to1Block(Ids::IRON_DOOR, Blocks::IRON_DOOR());
|
||||
$this->map1to1Block(Ids::JUNGLE_DOOR, Blocks::JUNGLE_DOOR());
|
||||
@ -502,19 +502,6 @@ final class ItemSerializerDeserializerRegistrar{
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers serializers and deserializers for blocks that don't fit any other pattern.
|
||||
* Ideally we want to get rid of this completely, if possible.
|
||||
*
|
||||
* Most of these are single PocketMine-MP items which map to multiple IDs depending on their properties, which is
|
||||
* complex to implement in a generic way.
|
||||
*/
|
||||
private function registerMiscBlockMappings() : void{
|
||||
$this->deserializer?->mapBlock(Ids::FRAME, fn() => Blocks::ITEM_FRAME()->setGlowing(false));
|
||||
$this->deserializer?->mapBlock(Ids::GLOW_FRAME, fn() => Blocks::ITEM_FRAME()->setGlowing(true));
|
||||
$this->serializer?->mapBlock(Blocks::ITEM_FRAME(), fn(ItemFrame $block) => new Data($block->isGlowing() ? Ids::GLOW_FRAME : Ids::FRAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers serializers and deserializers for items that don't fit any other pattern.
|
||||
* Ideally we want to get rid of this completely, if possible.
|
||||
|
Reference in New Issue
Block a user