Closed efor89 closed 3 years ago
hallo?
i try it in place funktion, set 2 blocks at same time 1 on the klick pos and 1 y + 1 its the same result the y + 1 set to update block
I try to set the block y + 1 but its always updateblock with id 255
set the block position to y + 1
public function onRandomTick(): void{
if($this->getDamage() === 0 and mt_rand(0, 50) == 16 and mt_rand(1, 5) == 3 and mt_rand(1, 6) == 3){
$block = clone $this;
$block->setDamage(1);
$block2 = clone $block;
$pos2 = new Position($this->x, $this->y + 1, $this->z, $this->getLevel());
$block2->position($pos2);
$this->getLevel()->setBlock($block, new Placeholder($block), true, true);
$this->getLevel()->setBlock($pos2, new Placeholder($block2), true, true);
}
}
my bad, i edited this comment multiple times
ty very much @DavyCraft648 work perfekt. can you tell me how i set in a other block this block? its for bamboo i try to replace the sepling with the bamboo.
ty very much @DavyCraft648 work perfekt. can you tell me how i set in a other block this block? its for bamboo i try to replace the sepling with the bamboo.
Just set the sepling to air and set a bamboo block where the sapling was
can you tell me how I set in a other block this block? its for bamboo I try to replace the sapling with the bamboo.
this is how I did it in my BambooSapling class
$bamboo = \pocketmine\block\BlockFactory::get(418, 0, $this); // 418 is bamboo block's id
$this->getLevel()->setBlock($this, new \JavierLeon9966\ExtendedBlocks\block\Placeholder($bamboo), true);
thx a lot now i have working bamboo 👍
i close the issue you help me a lot thx @DavyCraft648
hi i try to set the block y + 1 but its always updateblock with id 255, i hope you can help me
public function onRandomTick(): void{ if($this->getDamage() === 0 and mt_rand(0, 50) == 16 and mt_rand(1, 5) == 3 and mt_rand(1, 6) == 3){ $block = clone $this; $block->setDamage(1); $this->getLevel()->setBlock($block, new Placeholder($block), true, true); $this->getLevel()->setBlock(new Vector3($block->x, $block->y + 1, $block->z), new Placeholder($block), true, true); }