mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Level: Remove obsolete \$direct parameter from setBlock()
this parameter was previously used to send blocks with a different set of flags, immediately, to players. However, the flags have been demonstrated useless and the direct sending is pointless now since packets are buffered now per session, so we might as well take advantage of the batched block update sending.
This commit is contained in:
parent
16f2ac14b3
commit
75f364fcf2
@ -264,7 +264,7 @@ abstract class BaseRail extends Flowable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->connections = $connections;
|
$this->connections = $connections;
|
||||||
$this->level->setBlock($this, $this, false, false); //avoid recursion
|
$this->level->setBlock($this, $this, false); //avoid recursion
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
|
@ -96,11 +96,11 @@ class Bed extends Transparent{
|
|||||||
|
|
||||||
public function setOccupied(bool $occupied = true){
|
public function setOccupied(bool $occupied = true){
|
||||||
$this->occupied = $occupied;
|
$this->occupied = $occupied;
|
||||||
$this->level->setBlock($this, $this, false, false);
|
$this->level->setBlock($this, $this, false);
|
||||||
|
|
||||||
if(($other = $this->getOtherHalf()) !== null){
|
if(($other = $this->getOtherHalf()) !== null){
|
||||||
$other->occupied = $occupied;
|
$other->occupied = $occupied;
|
||||||
$this->level->setBlock($other, $other, false, false);
|
$this->level->setBlock($other, $other, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ class Bed extends Transparent{
|
|||||||
parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||||
$nextState = clone $this;
|
$nextState = clone $this;
|
||||||
$nextState->head = true;
|
$nextState->head = true;
|
||||||
$this->getLevel()->setBlock($next, $nextState, true, true);
|
$this->getLevel()->setBlock($next, $nextState);
|
||||||
|
|
||||||
Tile::createTile(Tile::BED, $this->getLevel(), TileBed::createNBT($this, $face, $item, $player));
|
Tile::createTile(Tile::BED, $this->getLevel(), TileBed::createNBT($this, $face, $item, $player));
|
||||||
Tile::createTile(Tile::BED, $this->getLevel(), TileBed::createNBT($next, $face, $item, $player));
|
Tile::createTile(Tile::BED, $this->getLevel(), TileBed::createNBT($next, $face, $item, $player));
|
||||||
|
@ -198,7 +198,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||||
return $this->getLevel()->setBlock($blockReplace, $this, true, true);
|
return $this->getLevel()->setBlock($blockReplace, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,7 +266,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function onBreak(Item $item, Player $player = null) : bool{
|
public function onBreak(Item $item, Player $player = null) : bool{
|
||||||
return $this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true, true);
|
return $this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class Cactus extends Transparent{
|
|||||||
if($b->getId() === self::AIR){
|
if($b->getId() === self::AIR){
|
||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, BlockFactory::get(Block::CACTUS)));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, BlockFactory::get(Block::CACTUS)));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
$this->getLevel()->setBlock($b, $ev->getNewState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class Cake extends Transparent implements FoodSource{
|
|||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
if($this->getSide(Facing::DOWN)->getId() === self::AIR){ //Replace with common break method
|
if($this->getSide(Facing::DOWN)->getId() === self::AIR){ //Replace with common break method
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ abstract class Crops extends Flowable{
|
|||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
||||||
|
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);
|
$this->getLevel()->setBlock($this, $ev->getNewState());
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->count--;
|
$item->count--;
|
||||||
@ -98,7 +98,7 @@ abstract class Crops extends Flowable{
|
|||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
||||||
|
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);
|
$this->getLevel()->setBlock($this, $ev->getNewState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,9 @@ class Dirt extends Solid{
|
|||||||
if($item instanceof Hoe){
|
if($item instanceof Hoe){
|
||||||
$item->applyDamage(1);
|
$item->applyDamage(1);
|
||||||
if($this->variant === self::COARSE){
|
if($this->variant === self::COARSE){
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::DIRT), true);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::DIRT));
|
||||||
}else{
|
}else{
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::FARMLAND), true);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::FARMLAND));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -143,9 +143,9 @@ abstract class Door extends Transparent{
|
|||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
if($this->getSide(Facing::DOWN)->getId() === self::AIR){ //Replace with common break method
|
if($this->getSide(Facing::DOWN)->getId() === self::AIR){ //Replace with common break method
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR));
|
||||||
if($this->getSide(Facing::UP) instanceof Door){
|
if($this->getSide(Facing::UP) instanceof Door){
|
||||||
$this->getLevel()->setBlock($this->getSide(Facing::UP), BlockFactory::get(Block::AIR), false);
|
$this->getLevel()->setBlock($this->getSide(Facing::UP), BlockFactory::get(Block::AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ abstract class Door extends Transparent{
|
|||||||
$topHalf->top = true;
|
$topHalf->top = true;
|
||||||
|
|
||||||
parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||||
$this->level->setBlock($blockUp, $topHalf, true); //Top
|
$this->level->setBlock($blockUp, $topHalf); //Top
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,10 +187,10 @@ abstract class Door extends Transparent{
|
|||||||
$other = $this->getSide($this->top ? Facing::DOWN : Facing::UP);
|
$other = $this->getSide($this->top ? Facing::DOWN : Facing::UP);
|
||||||
if($other instanceof Door and $this->getId() === $other->getId()){
|
if($other instanceof Door and $this->getId() === $other->getId()){
|
||||||
$other->open = $this->open;
|
$other->open = $this->open;
|
||||||
$this->level->setBlock($other, $other, true, true);
|
$this->level->setBlock($other, $other);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->level->setBlock($this, $this, true, true);
|
$this->level->setBlock($this, $this);
|
||||||
$this->level->addSound(new DoorSound($this));
|
$this->level->addSound(new DoorSound($this));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -54,10 +54,10 @@ class DoublePlant extends Flowable{
|
|||||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||||
$id = $blockReplace->getSide(Facing::DOWN)->getId();
|
$id = $blockReplace->getSide(Facing::DOWN)->getId();
|
||||||
if(($id === Block::GRASS or $id === Block::DIRT) and $blockReplace->getSide(Facing::UP)->canBeReplaced()){
|
if(($id === Block::GRASS or $id === Block::DIRT) and $blockReplace->getSide(Facing::UP)->canBeReplaced()){
|
||||||
$this->getLevel()->setBlock($blockReplace, $this, false, false);
|
$this->getLevel()->setBlock($blockReplace, $this, false);
|
||||||
$top = clone $this;
|
$top = clone $this;
|
||||||
$top->top = true;
|
$top->top = true;
|
||||||
$this->getLevel()->setBlock($blockReplace->getSide(Facing::UP), $top, false, false);
|
$this->getLevel()->setBlock($blockReplace->getSide(Facing::UP), $top, false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ abstract class Fallable extends Solid{
|
|||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
$down = $this->getSide(Facing::DOWN);
|
$down = $this->getSide(Facing::DOWN);
|
||||||
if($down->getId() === self::AIR or $down instanceof Liquid or $down instanceof Fire){
|
if($down->getId() === self::AIR or $down instanceof Liquid or $down instanceof Fire){
|
||||||
$this->level->setBlock($this, BlockFactory::get(Block::AIR), true);
|
$this->level->setBlock($this, BlockFactory::get(Block::AIR));
|
||||||
|
|
||||||
$nbt = Entity::createBaseNBT($this->add(0.5, 0, 0.5));
|
$nbt = Entity::createBaseNBT($this->add(0.5, 0, 0.5));
|
||||||
$nbt->setInt("TileID", $this->getId());
|
$nbt->setInt("TileID", $this->getId());
|
||||||
|
@ -69,7 +69,7 @@ class Farmland extends Transparent{
|
|||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
if($this->getSide(Facing::UP)->isSolid()){
|
if($this->getSide(Facing::UP)->isSolid()){
|
||||||
$this->level->setBlock($this, BlockFactory::get(Block::DIRT), true);
|
$this->level->setBlock($this, BlockFactory::get(Block::DIRT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,13 +81,13 @@ class Farmland extends Transparent{
|
|||||||
if(!$this->canHydrate()){
|
if(!$this->canHydrate()){
|
||||||
if($this->wetness > 0){
|
if($this->wetness > 0){
|
||||||
$this->wetness--;
|
$this->wetness--;
|
||||||
$this->level->setBlock($this, $this, false, false);
|
$this->level->setBlock($this, $this, false);
|
||||||
}else{
|
}else{
|
||||||
$this->level->setBlock($this, BlockFactory::get(Block::DIRT), false, true);
|
$this->level->setBlock($this, BlockFactory::get(Block::DIRT));
|
||||||
}
|
}
|
||||||
}elseif($this->wetness < 7){
|
}elseif($this->wetness < 7){
|
||||||
$this->wetness = 7;
|
$this->wetness = 7;
|
||||||
$this->level->setBlock($this, $this, false, false);
|
$this->level->setBlock($this, $this, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class FenceGate extends Transparent{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->getLevel()->setBlock($this, $this, true);
|
$this->getLevel()->setBlock($this, $this);
|
||||||
$this->level->addSound(new DoorSound($this));
|
$this->level->addSound(new DoorSound($this));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ class Fire extends Flowable{
|
|||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
if(!$this->getSide(Facing::DOWN)->isSolid() and !$this->hasAdjacentFlammableBlocks()){
|
if(!$this->getSide(Facing::DOWN)->isSolid() and !$this->hasAdjacentFlammableBlocks()){
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR));
|
||||||
}else{
|
}else{
|
||||||
$this->level->scheduleDelayedBlockUpdate($this, mt_rand(30, 40));
|
$this->level->scheduleDelayedBlockUpdate($this, mt_rand(30, 40));
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ class FlowerPot extends Flowable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->occupied = true;
|
$this->occupied = true;
|
||||||
$this->getLevel()->setBlock($this, $this, true, false);
|
$this->getLevel()->setBlock($this, $this, false);
|
||||||
$pot->setItem($item->pop());
|
$pot->setItem($item->pop());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -69,7 +69,7 @@ class Grass extends Solid{
|
|||||||
//grass dies
|
//grass dies
|
||||||
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($this, $this, BlockFactory::get(Block::DIRT)));
|
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($this, $this, BlockFactory::get(Block::DIRT)));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->level->setBlock($this, $ev->getNewState(), false, false);
|
$this->level->setBlock($this, $ev->getNewState(), false);
|
||||||
}
|
}
|
||||||
}elseif($lightAbove >= 9){
|
}elseif($lightAbove >= 9){
|
||||||
//try grass spread
|
//try grass spread
|
||||||
@ -88,7 +88,7 @@ class Grass extends Solid{
|
|||||||
|
|
||||||
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($b = $this->level->getBlockAt($x, $y, $z), $this, BlockFactory::get(Block::GRASS)));
|
$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($b = $this->level->getBlockAt($x, $y, $z), $this, BlockFactory::get(Block::GRASS)));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->level->setBlock($b, $ev->getNewState(), false, false);
|
$this->level->setBlock($b, $ev->getNewState(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class GrassPath extends Transparent{
|
|||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
if($this->getSide(Facing::UP)->isSolid()){
|
if($this->getSide(Facing::UP)->isSolid()){
|
||||||
$this->level->setBlock($this, BlockFactory::get(Block::DIRT), true);
|
$this->level->setBlock($this, BlockFactory::get(Block::DIRT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class Ice extends Transparent{
|
|||||||
|
|
||||||
public function onBreak(Item $item, Player $player = null) : bool{
|
public function onBreak(Item $item, Player $player = null) : bool{
|
||||||
if(!$item->hasEnchantment(Enchantment::SILK_TOUCH)){
|
if(!$item->hasEnchantment(Enchantment::SILK_TOUCH)){
|
||||||
return $this->getLevel()->setBlock($this, BlockFactory::get(Block::WATER), true);
|
return $this->getLevel()->setBlock($this, BlockFactory::get(Block::WATER));
|
||||||
}
|
}
|
||||||
return parent::onBreak($item, $player);
|
return parent::onBreak($item, $player);
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ class Leaves extends Transparent{
|
|||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
if(!$this->noDecay and !$this->checkDecay){
|
if(!$this->noDecay and !$this->checkDecay){
|
||||||
$this->checkDecay = true;
|
$this->checkDecay = true;
|
||||||
$this->getLevel()->setBlock($this, $this, true, false);
|
$this->getLevel()->setBlock($this, $this, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class Leaves extends Transparent{
|
|||||||
$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new LeavesDecayEvent($this));
|
$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new LeavesDecayEvent($this));
|
||||||
|
|
||||||
if($ev->isCancelled() or $this->findLog($this)){
|
if($ev->isCancelled() or $this->findLog($this)){
|
||||||
$this->getLevel()->setBlock($this, $this, false, false);
|
$this->getLevel()->setBlock($this, $this, false);
|
||||||
}else{
|
}else{
|
||||||
$this->getLevel()->useBreakOn($this);
|
$this->getLevel()->useBreakOn($this);
|
||||||
}
|
}
|
||||||
|
@ -248,13 +248,13 @@ abstract class Liquid extends Transparent{
|
|||||||
|
|
||||||
if($newDecay !== $this->decay or $falling !== $this->falling){
|
if($newDecay !== $this->decay or $falling !== $this->falling){
|
||||||
if(!$falling and $newDecay < 0){
|
if(!$falling and $newDecay < 0){
|
||||||
$this->level->setBlock($this, BlockFactory::get(Block::AIR), true, true);
|
$this->level->setBlock($this, BlockFactory::get(Block::AIR));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->falling = $falling;
|
$this->falling = $falling;
|
||||||
$this->decay = $falling ? 0 : $newDecay;
|
$this->decay = $falling ? 0 : $newDecay;
|
||||||
$this->level->setBlock($this, $this, true, true); //local block update will cause an update to be scheduled
|
$this->level->setBlock($this, $this); //local block update will cause an update to be scheduled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ abstract class Liquid extends Transparent{
|
|||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->falling = $falling;
|
$new->falling = $falling;
|
||||||
$new->decay = $falling ? 0 : $newFlowDecay;
|
$new->decay = $falling ? 0 : $newFlowDecay;
|
||||||
$this->level->setBlock($block, $new, true, true);
|
$this->level->setBlock($block, $new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +432,7 @@ abstract class Liquid extends Transparent{
|
|||||||
protected function liquidCollide(Block $cause, Block $result) : bool{
|
protected function liquidCollide(Block $cause, Block $result) : bool{
|
||||||
//TODO: add events
|
//TODO: add events
|
||||||
|
|
||||||
$this->level->setBlock($this, $result, true, true);
|
$this->level->setBlock($this, $result);
|
||||||
$this->level->broadcastLevelSoundEvent($this->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_FIZZ, (int) ((2.6 + (lcg_value() - lcg_value()) * 0.8) * 1000));
|
$this->level->broadcastLevelSoundEvent($this->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_FIZZ, (int) ((2.6 + (lcg_value() - lcg_value()) * 0.8) * 1000));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class MelonStem extends Crops{
|
|||||||
++$block->age;
|
++$block->age;
|
||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($this, $ev->getNewState(), true);
|
$this->getLevel()->setBlock($this, $ev->getNewState());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
foreach(Facing::HORIZONTAL as $side){
|
foreach(Facing::HORIZONTAL as $side){
|
||||||
@ -58,7 +58,7 @@ class MelonStem extends Crops{
|
|||||||
if($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){
|
if($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){
|
||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, BlockFactory::get(Block::MELON_BLOCK)));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, BlockFactory::get(Block::MELON_BLOCK)));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($side, $ev->getNewState(), true);
|
$this->getLevel()->setBlock($side, $ev->getNewState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class NetherWartPlant extends Flowable{
|
|||||||
$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
||||||
|
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($this, $ev->getNewState(), false, true);
|
$this->getLevel()->setBlock($this, $ev->getNewState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class PumpkinStem extends Crops{
|
|||||||
++$block->age;
|
++$block->age;
|
||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($this, $ev->getNewState(), true);
|
$this->getLevel()->setBlock($this, $ev->getNewState());
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
foreach(Facing::HORIZONTAL as $side){
|
foreach(Facing::HORIZONTAL as $side){
|
||||||
@ -58,7 +58,7 @@ class PumpkinStem extends Crops{
|
|||||||
if($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){
|
if($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){
|
||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, BlockFactory::get(Block::PUMPKIN)));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, BlockFactory::get(Block::PUMPKIN)));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($side, $ev->getNewState(), true);
|
$this->getLevel()->setBlock($side, $ev->getNewState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class RedstoneOre extends Solid{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||||
return $this->getLevel()->setBlock($this, $this, true, false);
|
return $this->getLevel()->setBlock($this, $this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null) : bool{
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
|
@ -85,7 +85,7 @@ class Sapling extends Flowable{
|
|||||||
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->getVariant());
|
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->getVariant());
|
||||||
}else{
|
}else{
|
||||||
$this->ready = true;
|
$this->ready = true;
|
||||||
$this->getLevel()->setBlock($this, $this, true);
|
$this->getLevel()->setBlock($this, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class SignPost extends Transparent{
|
|||||||
$this->rotation = $player !== null ? ((int) floor((($player->yaw + 180) * 16 / 360) + 0.5)) & 0x0f : 0;
|
$this->rotation = $player !== null ? ((int) floor((($player->yaw + 180) * 16 / 360) + 0.5)) & 0x0f : 0;
|
||||||
$ret = parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
$ret = parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||||
}else{
|
}else{
|
||||||
$ret = $this->getLevel()->setBlock($blockReplace, BlockFactory::get(Block::WALL_SIGN, $face), true);
|
$ret = $this->getLevel()->setBlock($blockReplace, BlockFactory::get(Block::WALL_SIGN, $face));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($ret){
|
if($ret){
|
||||||
|
@ -76,11 +76,11 @@ abstract class Slab extends Transparent{
|
|||||||
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
|
||||||
if($face === Facing::DOWN){
|
if($face === Facing::DOWN){
|
||||||
if($blockClicked instanceof Slab and $blockClicked->getId() === $this->getId() and $blockClicked->top and $blockClicked->getVariant() === $this->variant){
|
if($blockClicked instanceof Slab and $blockClicked->getId() === $this->getId() and $blockClicked->top and $blockClicked->getVariant() === $this->variant){
|
||||||
$this->getLevel()->setBlock($blockClicked, BlockFactory::get($this->getDoubleSlabId(), $this->variant), true);
|
$this->getLevel()->setBlock($blockClicked, BlockFactory::get($this->getDoubleSlabId(), $this->variant));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}elseif($blockReplace->getId() === $this->getId() and $blockReplace->getVariant() === $this->variant){
|
}elseif($blockReplace->getId() === $this->getId() and $blockReplace->getVariant() === $this->variant){
|
||||||
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->getDoubleSlabId(), $this->variant), true);
|
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->getDoubleSlabId(), $this->variant));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
@ -88,18 +88,18 @@ abstract class Slab extends Transparent{
|
|||||||
}
|
}
|
||||||
}elseif($face === Facing::UP){
|
}elseif($face === Facing::UP){
|
||||||
if($blockClicked instanceof Slab and $blockClicked->getId() === $this->getId() and !$blockClicked->top and $blockClicked->getVariant() === $this->variant){
|
if($blockClicked instanceof Slab and $blockClicked->getId() === $this->getId() and !$blockClicked->top and $blockClicked->getVariant() === $this->variant){
|
||||||
$this->getLevel()->setBlock($blockClicked, BlockFactory::get($this->getDoubleSlabId(), $this->variant), true);
|
$this->getLevel()->setBlock($blockClicked, BlockFactory::get($this->getDoubleSlabId(), $this->variant));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}elseif($blockReplace->getId() === $this->getId() and $blockReplace->getVariant() === $this->variant){
|
}elseif($blockReplace->getId() === $this->getId() and $blockReplace->getVariant() === $this->variant){
|
||||||
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->getDoubleSlabId(), $this->variant), true);
|
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->getDoubleSlabId(), $this->variant));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}else{ //TODO: collision
|
}else{ //TODO: collision
|
||||||
if($blockReplace->getId() === $this->getId()){
|
if($blockReplace->getId() === $this->getId()){
|
||||||
if($blockReplace->getVariant() === $this->variant){
|
if($blockReplace->getVariant() === $this->variant){
|
||||||
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->getDoubleSlabId(), $this->variant), true);
|
$this->getLevel()->setBlock($blockReplace, BlockFactory::get($this->getDoubleSlabId(), $this->variant));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ class SnowLayer extends Flowable{
|
|||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
if(!$this->getSide(Facing::DOWN)->isSolid()){
|
if(!$this->getSide(Facing::DOWN)->isSolid()){
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false, false);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class SnowLayer extends Flowable{
|
|||||||
|
|
||||||
public function onRandomTick() : void{
|
public function onRandomTick() : void{
|
||||||
if($this->level->getBlockLightAt($this->x, $this->y, $this->z) >= 12){
|
if($this->level->getBlockLightAt($this->x, $this->y, $this->z) >= 12){
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false, false);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class StandingBanner extends Transparent{
|
|||||||
$this->rotation = ((int) floor((($player->yaw + 180) * 16 / 360) + 0.5)) & 0x0f;
|
$this->rotation = ((int) floor((($player->yaw + 180) * 16 / 360) + 0.5)) & 0x0f;
|
||||||
$ret = parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
$ret = parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||||
}else{
|
}else{
|
||||||
$ret = $this->getLevel()->setBlock($blockReplace, BlockFactory::get(Block::WALL_BANNER, $face), true);
|
$ret = $this->getLevel()->setBlock($blockReplace, BlockFactory::get(Block::WALL_BANNER, $face));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($ret){
|
if($ret){
|
||||||
|
@ -67,13 +67,13 @@ class Sugarcane extends Flowable{
|
|||||||
if($b->getId() === self::AIR){
|
if($b->getId() === self::AIR){
|
||||||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, BlockFactory::get(Block::SUGARCANE_BLOCK)));
|
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, BlockFactory::get(Block::SUGARCANE_BLOCK)));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($b, $ev->getNewState(), true);
|
$this->getLevel()->setBlock($b, $ev->getNewState());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->age = 0;
|
$this->age = 0;
|
||||||
$this->getLevel()->setBlock($this, $this, true);
|
$this->getLevel()->setBlock($this, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->count--;
|
$item->count--;
|
||||||
@ -101,15 +101,15 @@ class Sugarcane extends Flowable{
|
|||||||
for($y = 1; $y < 3; ++$y){
|
for($y = 1; $y < 3; ++$y){
|
||||||
$b = $this->getLevel()->getBlockAt($this->x, $this->y + $y, $this->z);
|
$b = $this->getLevel()->getBlockAt($this->x, $this->y + $y, $this->z);
|
||||||
if($b->getId() === self::AIR){
|
if($b->getId() === self::AIR){
|
||||||
$this->getLevel()->setBlock($b, BlockFactory::get(Block::SUGARCANE_BLOCK), true);
|
$this->getLevel()->setBlock($b, BlockFactory::get(Block::SUGARCANE_BLOCK));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->age = 0;
|
$this->age = 0;
|
||||||
$this->getLevel()->setBlock($this, $this, true);
|
$this->getLevel()->setBlock($this, $this);
|
||||||
}else{
|
}else{
|
||||||
++$this->age;
|
++$this->age;
|
||||||
$this->getLevel()->setBlock($this, $this, true);
|
$this->getLevel()->setBlock($this, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ class TNT extends Solid{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function ignite(int $fuse = 80){
|
public function ignite(int $fuse = 80){
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR));
|
||||||
|
|
||||||
$mot = (new Random())->nextSignedFloat() * M_PI * 2;
|
$mot = (new Random())->nextSignedFloat() * M_PI * 2;
|
||||||
$nbt = Entity::createBaseNBT($this->add(0.5, 0, 0.5), new Vector3(-sin($mot) * 0.02, 0.2, -cos($mot) * 0.02));
|
$nbt = Entity::createBaseNBT($this->add(0.5, 0, 0.5), new Vector3(-sin($mot) * 0.02, 0.2, -cos($mot) * 0.02));
|
||||||
|
@ -46,7 +46,7 @@ class TallGrass extends Flowable{
|
|||||||
|
|
||||||
public function onNearbyBlockChange() : void{
|
public function onNearbyBlockChange() : void{
|
||||||
if($this->getSide(Facing::DOWN)->isTransparent()){ //Replace with common break method
|
if($this->getSide(Facing::DOWN)->isTransparent()){ //Replace with common break method
|
||||||
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true, true);
|
$this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ class Trapdoor extends Transparent{
|
|||||||
|
|
||||||
public function onActivate(Item $item, Player $player = null) : bool{
|
public function onActivate(Item $item, Player $player = null) : bool{
|
||||||
$this->open = !$this->open;
|
$this->open = !$this->open;
|
||||||
$this->level->setBlock($this, $this, true);
|
$this->level->setBlock($this, $this);
|
||||||
$this->level->addSound(new DoorSound($this));
|
$this->level->addSound(new DoorSound($this));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ class FallingBlock extends Entity{
|
|||||||
}else{
|
}else{
|
||||||
$this->server->getPluginManager()->callEvent($ev = new EntityBlockChangeEvent($this, $block, $blockTarget ?? $this->block));
|
$this->server->getPluginManager()->callEvent($ev = new EntityBlockChangeEvent($this, $block, $blockTarget ?? $this->block));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$this->getLevel()->setBlock($pos, $ev->getTo(), true);
|
$this->getLevel()->setBlock($pos, $ev->getTo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$hasUpdate = true;
|
$hasUpdate = true;
|
||||||
|
@ -61,7 +61,7 @@ class Bucket extends Item implements Consumable{
|
|||||||
$resultItem = ItemFactory::get(Item::BUCKET, $blockClicked->getFlowingForm()->getId());
|
$resultItem = ItemFactory::get(Item::BUCKET, $blockClicked->getFlowingForm()->getId());
|
||||||
$player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketFillEvent($player, $blockReplace, $face, $this, $resultItem));
|
$player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketFillEvent($player, $blockReplace, $face, $this, $resultItem));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$player->getLevel()->setBlock($blockClicked, BlockFactory::get(Block::AIR), true, true);
|
$player->getLevel()->setBlock($blockClicked, BlockFactory::get(Block::AIR));
|
||||||
$player->getLevel()->broadcastLevelSoundEvent($blockClicked->add(0.5, 0.5, 0.5), $blockClicked->getBucketFillSound());
|
$player->getLevel()->broadcastLevelSoundEvent($blockClicked->add(0.5, 0.5, 0.5), $blockClicked->getBucketFillSound());
|
||||||
if($player->isSurvival()){
|
if($player->isSurvival()){
|
||||||
if($stack->getCount() === 0){
|
if($stack->getCount() === 0){
|
||||||
@ -82,7 +82,7 @@ class Bucket extends Item implements Consumable{
|
|||||||
}elseif($resultBlock instanceof Liquid and $blockReplace->canBeReplaced()){
|
}elseif($resultBlock instanceof Liquid and $blockReplace->canBeReplaced()){
|
||||||
$player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketEmptyEvent($player, $blockReplace, $face, $this, ItemFactory::get(Item::BUCKET)));
|
$player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketEmptyEvent($player, $blockReplace, $face, $this, ItemFactory::get(Item::BUCKET)));
|
||||||
if(!$ev->isCancelled()){
|
if(!$ev->isCancelled()){
|
||||||
$player->getLevel()->setBlock($blockReplace, $resultBlock->getFlowingForm(), true, true);
|
$player->getLevel()->setBlock($blockReplace, $resultBlock->getFlowingForm());
|
||||||
$player->getLevel()->broadcastLevelSoundEvent($blockClicked->add(0.5, 0.5, 0.5), $resultBlock->getBucketEmptySound());
|
$player->getLevel()->broadcastLevelSoundEvent($blockClicked->add(0.5, 0.5, 0.5), $resultBlock->getBucketEmptySound());
|
||||||
|
|
||||||
if($player->isSurvival()){
|
if($player->isSurvival()){
|
||||||
|
@ -38,7 +38,7 @@ class FlintSteel extends Tool{
|
|||||||
if($blockReplace->getId() === self::AIR){
|
if($blockReplace->getId() === self::AIR){
|
||||||
$level = $player->getLevel();
|
$level = $player->getLevel();
|
||||||
assert($level !== null);
|
assert($level !== null);
|
||||||
$level->setBlock($blockReplace, BlockFactory::get(Block::FIRE), true);
|
$level->setBlock($blockReplace, BlockFactory::get(Block::FIRE));
|
||||||
$level->broadcastLevelSoundEvent($blockReplace->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_IGNITE);
|
$level->broadcastLevelSoundEvent($blockReplace->add(0.5, 0.5, 0.5), LevelSoundEventPacket::SOUND_IGNITE);
|
||||||
|
|
||||||
$this->applyDamage(1);
|
$this->applyDamage(1);
|
||||||
|
@ -1475,21 +1475,16 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
* Sets on Vector3 the data from a Block object,
|
* Sets on Vector3 the data from a Block object,
|
||||||
* does block updates and puts the changes to the send queue.
|
* does block updates and puts the changes to the send queue.
|
||||||
*
|
*
|
||||||
* If $direct is true, it'll send changes directly to players. if false, it'll be queued
|
|
||||||
* and the best way to send queued changes will be done in the next tick.
|
|
||||||
* This way big changes can be sent on a single chunk update packet instead of thousands of packets.
|
|
||||||
*
|
|
||||||
* If $update is true, it'll get the neighbour blocks (6 sides) and update them.
|
* If $update is true, it'll get the neighbour blocks (6 sides) and update them.
|
||||||
* If you are doing big changes, you might want to set this to false, then update manually.
|
* If you are doing big changes, you might want to set this to false, then update manually.
|
||||||
*
|
*
|
||||||
* @param Vector3 $pos
|
* @param Vector3 $pos
|
||||||
* @param Block $block
|
* @param Block $block
|
||||||
* @param bool $direct @deprecated
|
|
||||||
* @param bool $update
|
* @param bool $update
|
||||||
*
|
*
|
||||||
* @return bool Whether the block has been updated or not
|
* @return bool Whether the block has been updated or not
|
||||||
*/
|
*/
|
||||||
public function setBlock(Vector3 $pos, Block $block, bool $direct = false, bool $update = true) : bool{
|
public function setBlock(Vector3 $pos, Block $block, bool $update = true) : bool{
|
||||||
$pos = $pos->floor();
|
$pos = $pos->floor();
|
||||||
if(!$this->isInWorld($pos->x, $pos->y, $pos->z)){
|
if(!$this->isInWorld($pos->x, $pos->y, $pos->z)){
|
||||||
return false;
|
return false;
|
||||||
@ -1512,16 +1507,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
unset($this->blockCache[$chunkHash][$blockHash]);
|
unset($this->blockCache[$chunkHash][$blockHash]);
|
||||||
|
|
||||||
if($direct){
|
|
||||||
$this->sendBlocks($this->getChunkPlayers($pos->x >> 4, $pos->z >> 4), [$block]);
|
|
||||||
unset($this->chunkCache[$chunkHash], $this->changedBlocks[$chunkHash][$blockHash]);
|
|
||||||
}else{
|
|
||||||
if(!isset($this->changedBlocks[$chunkHash])){
|
if(!isset($this->changedBlocks[$chunkHash])){
|
||||||
$this->changedBlocks[$chunkHash] = [];
|
$this->changedBlocks[$chunkHash] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->changedBlocks[$chunkHash][$blockHash] = $block;
|
$this->changedBlocks[$chunkHash][$blockHash] = $block;
|
||||||
}
|
|
||||||
|
|
||||||
foreach($this->getChunkLoaders($pos->x >> 4, $pos->z >> 4) as $loader){
|
foreach($this->getChunkLoaders($pos->x >> 4, $pos->z >> 4) as $loader){
|
||||||
$loader->onBlockChanged($block);
|
$loader->onBlockChanged($block);
|
||||||
|
@ -146,7 +146,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
$block = $this->getBlock();
|
$block = $this->getBlock();
|
||||||
if($block instanceof BlockFurnace and !$block->isLit()){
|
if($block instanceof BlockFurnace and !$block->isLit()){
|
||||||
$block->setLit(true);
|
$block->setLit(true);
|
||||||
$this->getLevel()->setBlock($block, $block, true);
|
$this->getLevel()->setBlock($block, $block);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->burnTime > 0 and $ev->isBurning()){
|
if($this->burnTime > 0 and $ev->isBurning()){
|
||||||
@ -210,7 +210,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
$block = $this->getBlock();
|
$block = $this->getBlock();
|
||||||
if($block instanceof BlockFurnace and $block->isLit()){
|
if($block instanceof BlockFurnace and $block->isLit()){
|
||||||
$block->setLit(false);
|
$block->setLit(false);
|
||||||
$this->getLevel()->setBlock($block, $block, true);
|
$this->getLevel()->setBlock($block, $block);
|
||||||
}
|
}
|
||||||
$this->burnTime = $this->cookTime = $this->maxTime = 0;
|
$this->burnTime = $this->cookTime = $this->maxTime = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user