Fixed commit #3595 #3724
Fixed commit #3595 #3724
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,16 +63,20 @@ public function getDrops(Item $item){ | |
|
||
public function onUpdate($type){ | ||
if($type === Level::BLOCK_UPDATE_RANDOM){ | ||
//TODO: light levels | ||
$x = mt_rand($this->x - 1, $this->x + 1); | ||
$y = mt_rand($this->y - 2, $this->y + 2); | ||
$z = mt_rand($this->z - 1, $this->z + 1); | ||
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z)); | ||
if($block->getId() === Block::DIRT){ | ||
if($block->getSide(1) instanceof Transparent){ | ||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Grass())); | ||
if(!$ev->isCancelled()){ | ||
$this->getLevel()->setBlock($block, $ev->getNewState()); | ||
$block = $this->getLevel()->getBlock(new Vector3($this->x, $this->y, $this->z)); | ||
if($block->getSide(1)->getLightLevel() < 4){ | ||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Dirt())); | ||
}elseif($block->getSide(1)->getLightLevel() >= 9){ | ||
for($l = 0; $l < 4; ++$l){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Uhm just a simple thing: You see this line but complain about the other? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bump THIS LINE There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could understand that @PEMapModder didn't realize the getBlock leak problem since @shoghicp added it, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shoghicp added it back in October 2014, so probably too late to blame him. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semms so. @dktapps seems to be on a fix |
||
$x = mt_rand($this->x - 1, $this->x + 1); | ||
$y = mt_rand($this->y - 2, $this->y + 2); | ||
$z = mt_rand($this->z - 1, $this->z + 1); | ||
$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z)); | ||
if($block->getId() === Block::DIRT && $block->getDamage() === 0x0F && $block->getSide(1)->getLightLevel() >= 4 && $block->z <= 2){ | ||
Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Grass())); | ||
if(!$ev->isCancelled()){ | ||
$this->getLevel()->setBlock($block, $ev->getNewState()); | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -99,4 +103,4 @@ public function onActivate(Item $item, Player $player = null){ | |
|
||
return false; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PEMapModder y u merge this
wtf wtf wtf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$block = $this; 🤦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dan of 2015..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SOF3 no need to shout. He isn't active.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where. is. the. FACEDESK. EMOJI. NOW.