mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Fixed infinite loop when placing two coral plants next to each other
the dead flag is not persisted in their metadata, so they forget their state when next read from the world.
This commit is contained in:
parent
4e0bc6c98e
commit
fc01735b6f
@ -30,6 +30,18 @@ use pocketmine\world\BlockTransaction;
|
||||
|
||||
final class Coral extends BaseCoral{
|
||||
|
||||
public function readStateFromWorld() : void{
|
||||
//TODO: this hack ensures correct state of coral plants, because they don't retain their dead flag in metadata
|
||||
$world = $this->pos->getWorld();
|
||||
$this->dead = true;
|
||||
foreach($this->pos->sides() as $vector3){
|
||||
if($world->getBlock($vector3) instanceof Water){
|
||||
$this->dead = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
|
||||
if(!$tx->fetchBlock($blockReplace->getPos()->down())->isSolid()){
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user