mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 21:19:44 +00:00
sugracane & cactus fixed, fixed sigsegv too early
This commit is contained in:
parent
b52e050f8c
commit
2ad06e202f
3 changed files with 14 additions and 12 deletions
|
|
@ -194,12 +194,11 @@ class PocketMinecraftServer{
|
||||||
console("[WARNING] Can't keep up! Is the server overloaded?");
|
console("[WARNING] Can't keep up! Is the server overloaded?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static $_tmp;
|
||||||
/**
|
/**
|
||||||
* @param string $reason
|
* @param string $reason
|
||||||
*/
|
*/
|
||||||
public function close($reason = "server stop"){
|
public function close($reason = "server stop"){
|
||||||
usleep(2);
|
|
||||||
$this->onShutdown();
|
$this->onShutdown();
|
||||||
if($this->stop !== true){
|
if($this->stop !== true){
|
||||||
if(is_int($reason)){
|
if(is_int($reason)){
|
||||||
|
|
@ -208,13 +207,12 @@ class PocketMinecraftServer{
|
||||||
if(($this->api instanceof ServerAPI) === true){
|
if(($this->api instanceof ServerAPI) === true){
|
||||||
if(($this->api->chat instanceof ChatAPI) === true){
|
if(($this->api->chat instanceof ChatAPI) === true){
|
||||||
$this->api->chat->send(false, "Stopping server...");
|
$this->api->chat->send(false, "Stopping server...");
|
||||||
new StopMessageThread($this, "[INFO] Stopping server..."); //broadcast didnt want to send message to discord for some reason
|
self::$_tmp = new StopMessageThread($this, "[INFO] Stopping server..."); //broadcast didnt want to send message to discord for some reason
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->stop = true;
|
$this->stop = true;
|
||||||
$this->trigger("server.close", $reason);
|
$this->trigger("server.close", $reason);
|
||||||
$this->interface->close();
|
$this->interface->close();
|
||||||
|
|
||||||
if(!defined("NO_THREADS")){
|
if(!defined("NO_THREADS")){
|
||||||
$this->asyncThread->synchronized(function ($t){
|
$this->asyncThread->synchronized(function ($t){
|
||||||
$t->stop = true;
|
$t->stop = true;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class CactusBlock extends TransparentBlock{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){
|
public static function neighborChanged(Level $level, $x, $y, $z, $nX, $nY, $nZ, $oldID){
|
||||||
$down = $level->level->getBlockID($x, $y, $z);
|
$down = $level->level->getBlockID($x, $y - 1, $z);
|
||||||
$b0 = $level->level->getBlockID($x, $y, $z - 1);
|
$b0 = $level->level->getBlockID($x, $y, $z - 1);
|
||||||
$b1 = $level->level->getBlockID($x, $y, $z + 1);
|
$b1 = $level->level->getBlockID($x, $y, $z + 1);
|
||||||
$b2 = $level->level->getBlockID($x - 1, $y, $z);
|
$b2 = $level->level->getBlockID($x - 1, $y, $z);
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,17 @@ class SugarcaneBlock extends FlowableBlock{
|
||||||
$this->level->setBlock($block, new SugarcaneBlock(), true, false, true);
|
$this->level->setBlock($block, new SugarcaneBlock(), true, false, true);
|
||||||
return true;
|
return true;
|
||||||
}elseif($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === SAND){
|
}elseif($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === SAND){
|
||||||
$block0 = $down->getSide(2);
|
$level = $this->level;
|
||||||
$block1 = $down->getSide(3);
|
$x = $this->x;
|
||||||
$block2 = $down->getSide(4);
|
$y = $this->y;
|
||||||
$block3 = $down->getSide(5);
|
$z = $this->z;
|
||||||
if(($block0 instanceof WaterBlock) or ($block1 instanceof WaterBlock) or ($block2 instanceof WaterBlock) or ($block3 instanceof WaterBlock)){
|
|
||||||
$this->level->setBlock($block, new SugarcaneBlock(), true, false, true);
|
$b0 = $level->level->getBlockID($x, $y - 1, $z - 1);
|
||||||
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
|
$b1 = $level->level->getBlockID($x, $y - 1, $z + 1);
|
||||||
|
$b2 = $level->level->getBlockID($x - 1, $y - 1, $z);
|
||||||
|
$b3 = $level->level->getBlockID($x + 1, $y - 1, $z);
|
||||||
|
if($b0 == WATER || $b0 == STILL_WATER || $b1 == WATER || $b1 == STILL_WATER || $b2 == WATER || $b2 == STILL_WATER || $b3 == WATER || $b3 == STILL_WATER){
|
||||||
|
$level->fastSetBlockUpdate($block->x, $block->y, $block->z, SUGARCANE_BLOCK, 0, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue