mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Implement campfire & soul campfire (#4696)
This commit is contained in:
@ -43,6 +43,7 @@ use pocketmine\block\Cactus;
|
||||
use pocketmine\block\Cake;
|
||||
use pocketmine\block\CakeWithCandle;
|
||||
use pocketmine\block\CakeWithDyedCandle;
|
||||
use pocketmine\block\Campfire;
|
||||
use pocketmine\block\Candle;
|
||||
use pocketmine\block\Carpet;
|
||||
use pocketmine\block\Carrot;
|
||||
@ -124,6 +125,7 @@ use pocketmine\block\SimplePressurePlate;
|
||||
use pocketmine\block\Slab;
|
||||
use pocketmine\block\SmallDripleaf;
|
||||
use pocketmine\block\SnowLayer;
|
||||
use pocketmine\block\SoulCampfire;
|
||||
use pocketmine\block\Sponge;
|
||||
use pocketmine\block\StainedGlass;
|
||||
use pocketmine\block\StainedGlassPane;
|
||||
@ -1160,6 +1162,11 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
return Writer::create(Ids::CAKE)
|
||||
->writeInt(StateNames::BITE_COUNTER, $block->getBites());
|
||||
});
|
||||
$this->map(Blocks::CAMPFIRE(), function(Campfire $block) : Writer{
|
||||
return Writer::create(Ids::CAMPFIRE)
|
||||
->writeCardinalHorizontalFacing($block->getFacing())
|
||||
->writeBool(StateNames::EXTINGUISHED, !$block->isLit());
|
||||
});
|
||||
$this->map(Blocks::CARROTS(), fn(Carrot $block) => Helper::encodeCrops($block, new Writer(Ids::CARROTS)));
|
||||
$this->map(Blocks::CARVED_PUMPKIN(), function(CarvedPumpkin $block) : Writer{
|
||||
return Writer::create(Ids::CARVED_PUMPKIN)
|
||||
@ -1638,6 +1645,11 @@ final class BlockObjectToStateSerializer implements BlockStateSerializer{
|
||||
->writeBool(StateNames::COVERED_BIT, false)
|
||||
->writeInt(StateNames::HEIGHT, $block->getLayers() - 1);
|
||||
});
|
||||
$this->map(Blocks::SOUL_CAMPFIRE(), function(SoulCampfire $block) : Writer{
|
||||
return Writer::create(Ids::SOUL_CAMPFIRE)
|
||||
->writeCardinalHorizontalFacing($block->getFacing())
|
||||
->writeBool(StateNames::EXTINGUISHED, !$block->isLit());
|
||||
});
|
||||
$this->map(Blocks::SOUL_FIRE(), function() : Writer{
|
||||
return Writer::create(Ids::SOUL_FIRE)
|
||||
->writeInt(StateNames::AGE, 0); //useless for soul fire, we don't track it
|
||||
|
@ -1039,6 +1039,11 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
return Blocks::CAKE()
|
||||
->setBites($in->readBoundedInt(StateNames::BITE_COUNTER, 0, 6));
|
||||
});
|
||||
$this->map(Ids::CAMPFIRE, function(Reader $in) : Block{
|
||||
return Blocks::CAMPFIRE()
|
||||
->setFacing($in->readCardinalHorizontalFacing())
|
||||
->setLit(!$in->readBool(StateNames::EXTINGUISHED));
|
||||
});
|
||||
$this->map(Ids::CARROTS, fn(Reader $in) => Helper::decodeCrops(Blocks::CARROTS(), $in));
|
||||
$this->map(Ids::CARVED_PUMPKIN, function(Reader $in) : Block{
|
||||
return Blocks::CARVED_PUMPKIN()
|
||||
@ -1525,6 +1530,11 @@ final class BlockStateToObjectDeserializer implements BlockStateDeserializer{
|
||||
$in->ignored(StateNames::COVERED_BIT); //seems to be useless
|
||||
return Blocks::SNOW_LAYER()->setLayers($in->readBoundedInt(StateNames::HEIGHT, 0, 7) + 1);
|
||||
});
|
||||
$this->map(Ids::SOUL_CAMPFIRE, function(Reader $in) : Block{
|
||||
return Blocks::SOUL_CAMPFIRE()
|
||||
->setFacing($in->readCardinalHorizontalFacing())
|
||||
->setLit(!$in->readBool(StateNames::EXTINGUISHED));
|
||||
});
|
||||
$this->map(Ids::SOUL_FIRE, function(Reader $in) : Block{
|
||||
$in->ignored(StateNames::AGE); //this is useless for soul fire, since it doesn't have the logic associated
|
||||
return Blocks::SOUL_FIRE();
|
||||
|
@ -133,6 +133,7 @@ final class ItemSerializerDeserializerRegistrar{
|
||||
$this->map1to1Block(Ids::BIRCH_DOOR, Blocks::BIRCH_DOOR());
|
||||
$this->map1to1Block(Ids::BREWING_STAND, Blocks::BREWING_STAND());
|
||||
$this->map1to1Block(Ids::CAKE, Blocks::CAKE());
|
||||
$this->map1to1Block(Ids::CAMPFIRE, Blocks::CAMPFIRE());
|
||||
$this->map1to1Block(Ids::CAULDRON, Blocks::CAULDRON());
|
||||
$this->map1to1Block(Ids::CHAIN, Blocks::CHAIN());
|
||||
$this->map1to1Block(Ids::CHERRY_DOOR, Blocks::CHERRY_DOOR());
|
||||
@ -148,6 +149,7 @@ final class ItemSerializerDeserializerRegistrar{
|
||||
$this->map1to1Block(Ids::MANGROVE_DOOR, Blocks::MANGROVE_DOOR());
|
||||
$this->map1to1Block(Ids::NETHER_WART, Blocks::NETHER_WART());
|
||||
$this->map1to1Block(Ids::REPEATER, Blocks::REDSTONE_REPEATER());
|
||||
$this->map1to1Block(Ids::SOUL_CAMPFIRE, Blocks::SOUL_CAMPFIRE());
|
||||
$this->map1to1Block(Ids::SPRUCE_DOOR, Blocks::SPRUCE_DOOR());
|
||||
$this->map1to1Block(Ids::SUGAR_CANE, Blocks::SUGARCANE());
|
||||
$this->map1to1Block(Ids::WARPED_DOOR, Blocks::WARPED_DOOR());
|
||||
|
Reference in New Issue
Block a user