mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Removed FlowerPot update_bit hack
This commit is contained in:
parent
5874ce582a
commit
71df15b4cc
@ -193,7 +193,12 @@ class BlockFactory{
|
|||||||
$this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_POPPY), "Poppy", BlockBreakInfo::instant()));
|
$this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_POPPY), "Poppy", BlockBreakInfo::instant()));
|
||||||
$this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_RED_TULIP), "Red Tulip", BlockBreakInfo::instant()));
|
$this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_RED_TULIP), "Red Tulip", BlockBreakInfo::instant()));
|
||||||
$this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_WHITE_TULIP), "White Tulip", BlockBreakInfo::instant()));
|
$this->register(new Flower(new BID(Ids::RED_FLOWER, Meta::FLOWER_WHITE_TULIP), "White Tulip", BlockBreakInfo::instant()));
|
||||||
$this->register(new FlowerPot(new BID(Ids::FLOWER_POT_BLOCK, 0, ItemIds::FLOWER_POT, TileFlowerPot::class), "Flower Pot", BlockBreakInfo::instant()));
|
|
||||||
|
$flowerPot = new FlowerPot(new BID(Ids::FLOWER_POT_BLOCK, 0, ItemIds::FLOWER_POT, TileFlowerPot::class), "Flower Pot", BlockBreakInfo::instant());
|
||||||
|
$this->register($flowerPot);
|
||||||
|
for($meta = 1; $meta < 16; ++$meta){
|
||||||
|
$this->remap(Ids::FLOWER_POT_BLOCK, $meta, $flowerPot);
|
||||||
|
}
|
||||||
$this->register(new FrostedIce(new BID(Ids::FROSTED_ICE, 0), "Frosted Ice", new BlockBreakInfo(2.5, BlockToolType::PICKAXE)));
|
$this->register(new FrostedIce(new BID(Ids::FROSTED_ICE, 0), "Frosted Ice", new BlockBreakInfo(2.5, BlockToolType::PICKAXE)));
|
||||||
$this->register(new Furnace(new BIDFlattened(Ids::FURNACE, [Ids::LIT_FURNACE], 0, null, TileFurnace::class), "Furnace", new BlockBreakInfo(3.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())));
|
$this->register(new Furnace(new BIDFlattened(Ids::FURNACE, [Ids::LIT_FURNACE], 0, null, TileFurnace::class), "Furnace", new BlockBreakInfo(3.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())));
|
||||||
|
|
||||||
|
@ -34,22 +34,15 @@ use function assert;
|
|||||||
|
|
||||||
class FlowerPot extends Flowable{
|
class FlowerPot extends Flowable{
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO: get rid of this hack (it's currently needed to deal with blockfactory state handling)
|
|
||||||
*/
|
|
||||||
protected bool $occupied = false;
|
|
||||||
protected ?Block $plant = null;
|
protected ?Block $plant = null;
|
||||||
|
|
||||||
protected function writeStateToMeta() : int{
|
protected function writeStateToMeta() : int{
|
||||||
return $this->occupied ? BlockLegacyMetadata::FLOWER_POT_FLAG_OCCUPIED : 0;
|
//TODO: HACK! this is just to make the client actually render the plant - we purposely don't read the flag back
|
||||||
}
|
return $this->plant !== null ? BlockLegacyMetadata::FLOWER_POT_FLAG_OCCUPIED : 0;
|
||||||
|
|
||||||
public function readStateFromData(int $id, int $stateMeta) : void{
|
|
||||||
$this->occupied = ($stateMeta & BlockLegacyMetadata::FLOWER_POT_FLAG_OCCUPIED) !== 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStateBitmask() : int{
|
public function getStateBitmask() : int{
|
||||||
return 0b1111; //vanilla uses various values, we only care about 1 and 0 for PE
|
return 0b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readStateFromWorld() : void{
|
public function readStateFromWorld() : void{
|
||||||
@ -58,7 +51,7 @@ class FlowerPot extends Flowable{
|
|||||||
if($tile instanceof TileFlowerPot){
|
if($tile instanceof TileFlowerPot){
|
||||||
$this->setPlant($tile->getPlant());
|
$this->setPlant($tile->getPlant());
|
||||||
}else{
|
}else{
|
||||||
$this->occupied = false;
|
$this->setPlant(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +74,6 @@ class FlowerPot extends Flowable{
|
|||||||
}else{
|
}else{
|
||||||
$this->plant = clone $plant;
|
$this->plant = clone $plant;
|
||||||
}
|
}
|
||||||
$this->occupied = $this->plant !== null;
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user