mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
extra.properties cleanup, fixed fire/water/lava collisions
This commit is contained in:
parent
86e32a1620
commit
8f720231fa
9 changed files with 20 additions and 31 deletions
|
|
@ -137,10 +137,12 @@ class ServerAPI{
|
|||
"enable-rcon" => false,
|
||||
"rcon.password" => substr(base64_encode(Utils::getRandomBytes(20, false)), 3, 10),
|
||||
"auto-save" => true,
|
||||
"enable-mob-ai" => true,
|
||||
]);
|
||||
|
||||
$this->parseProperties();
|
||||
MobSpawner::$MOB_LIMIT = $this->getProperty("mobs-amount", 50);
|
||||
Entity::$allowedAI = $this->getProperty("enable-mob-ai", true);
|
||||
//Load advanced properties
|
||||
define("DEBUG", $this->getProperty("debug", 1));
|
||||
define("ADVANCED_CACHE", $this->getProperty("enable-advanced-cache", false));
|
||||
|
|
|
|||
|
|
@ -1482,7 +1482,7 @@ class Player{
|
|||
$this->server->api->entity->spawnAll($this);
|
||||
$this->server->api->entity->spawnToAll($this->entity);
|
||||
|
||||
$this->server->schedule(5, [$this->entity, "update"], [], true);
|
||||
//$this->server->schedule(5, [$this->entity, "update"], [], true);
|
||||
$this->server->schedule(2, [$this->entity, "updateMovement"], [], true);
|
||||
$this->sendArmor();
|
||||
$array = explode("@n", (string)$this->server->motd);
|
||||
|
|
|
|||
|
|
@ -77,11 +77,8 @@ class PocketMinecraftServer{
|
|||
console("[INFO] Loading extra.properties...");
|
||||
$this->extraprops = new Config(DATA_PATH . "extra.properties", CONFIG_PROPERTIES, [
|
||||
"version" => "5",
|
||||
"experemental-mob-features" => true,
|
||||
"enable-mob-ai" => false,
|
||||
"enable-nether-reactor" => true,
|
||||
"enable-explosions" => true,
|
||||
"enable-rail-connection" => true,
|
||||
"save-player-data" => true,
|
||||
"save-console-data" => true,
|
||||
"query-plugins" => false,
|
||||
|
|
@ -91,20 +88,15 @@ class PocketMinecraftServer{
|
|||
"discord-bot-name" => "NostalgiaCore Logger",
|
||||
"despawn-mobs" => true,
|
||||
"mob-despawn-ticks" => 18000,
|
||||
"16x16x16_chunk_sending" => false
|
||||
|
||||
"16x16x16_chunk_sending" => false,
|
||||
"experimental-mob-ai" => false,
|
||||
]);
|
||||
Player::$smallChunks = $this->extraprops->get("16x16x16_chunk_sending");
|
||||
Living::$despawnMobs = $this->extraprops->get("despawn-mobs");
|
||||
Living::$despawnTimer = $this->extraprops->get("mob-despawn-ticks");
|
||||
Entity::$allowedAI = $this->extraprops->get("enable-mob-ai");
|
||||
Entity::$updateOnTick = $this->extraprops->get("experemental-mob-features");
|
||||
PocketMinecraftServer::$SAVE_PLAYER_DATA = $this->extraprops->get("save-player-data");
|
||||
if(Entity::$updateOnTick){
|
||||
console("[WARNING] Experemental mob features are enabled. Unpredictable behavior.");
|
||||
}
|
||||
MobController::$ADVANCED = $this->extraprops->get("experimental-mob-ai");
|
||||
Explosion::$enableExplosions = $this->extraprops->get("enable-explosions");
|
||||
RailBlock::$shouldconnectrails = $this->extraprops->get("enable-rail-connection"); //Rail connection in config
|
||||
NetherReactorBlock::$enableReactor = $this->extraprops->get("enable-nether-reactor");
|
||||
if($this->extraprops->get("discord-msg") == true){
|
||||
if($this->extraprops->get("discord-webhook-url") !== "none"){
|
||||
|
|
@ -223,7 +215,6 @@ class PocketMinecraftServer{
|
|||
$t->stop = true;
|
||||
$t->notify();
|
||||
}, $this->asyncThread);
|
||||
//@$this->asyncThread->stop = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ class Entity extends Position
|
|||
|
||||
public function environmentUpdate()
|
||||
{
|
||||
$hasUpdate = Entity::$updateOnTick ? $this->class === ENTITY_MOB : false; // force true for mobs
|
||||
$hasUpdate = $this->class === ENTITY_MOB; // force true for mobs
|
||||
$time = microtime(true);
|
||||
if($this->class === ENTITY_PLAYER and ($this->player instanceof Player) and $this->player->spawned === true and $this->player->blocked !== true && ! $this->dead){
|
||||
foreach($this->server->api->entity->getRadius($this, 2, ENTITY_ITEM) as $item){ //TODO vanilla method of searching/radius
|
||||
|
|
@ -429,7 +429,7 @@ class Entity extends Position
|
|||
switch ($id) {
|
||||
case WATER:
|
||||
case STILL_WATER: // Drowing
|
||||
if ($this->fire > 0 and $this->inBlockNonVector($x, $y, $z)) {
|
||||
if ($this->fire > 0 and $this->inBlock(new Vector3($x, $y, $z))) {
|
||||
$this->fire = 0;
|
||||
$this->updateMetadata();
|
||||
}
|
||||
|
|
@ -446,7 +446,7 @@ class Entity extends Position
|
|||
break;
|
||||
case LAVA: // Lava damage
|
||||
case STILL_LAVA:
|
||||
if ((!$this->isPlayer() && StaticBlock::getBoundingBoxForBlockCoords($id, $x, $y, $z)->intersectsWith($this->boundingBox)) || ($this->isPlayer() && $this->inBlockNonVector($x, $y, $z))) {
|
||||
if ($this->inBlock(new Vector3($x, $y, $z))) {
|
||||
$this->harm(5, "lava");
|
||||
$this->fire = 300;
|
||||
$this->updateMetadata();
|
||||
|
|
@ -454,7 +454,7 @@ class Entity extends Position
|
|||
}
|
||||
break;
|
||||
case FIRE: // Fire block damage
|
||||
if ((!$this->isPlayer() && StaticBlock::getBoundingBoxForBlockCoords($id, $x, $y, $z)->intersectsWith($this->boundingBox)) || ($this->isPlayer() && $this->inBlockNonVector($x, $y, $z))) {
|
||||
if ($this->inBlock(new Vector3($x, $y, $z))) {
|
||||
$this->harm(1, "fire");
|
||||
$this->fire = 300;
|
||||
$this->updateMetadata();
|
||||
|
|
@ -468,7 +468,7 @@ class Entity extends Position
|
|||
}
|
||||
break;
|
||||
default:
|
||||
if($this->inBlockNonVector($x, $y, $z, 0.7) && $y == $endY and !StaticBlock::getIsTransparent($id) && ($this->class === ENTITY_MOB || $this->class === ENTITY_PLAYER)){
|
||||
if($this->inBlock(new Vector3($x, $y, $z), 0.7) && $y == $endY and !StaticBlock::getIsTransparent($id) && ($this->class === ENTITY_MOB || $this->class === ENTITY_PLAYER)){
|
||||
|
||||
}elseif($x == ($endX - 1) and $y == $endY and $z == ($endZ - 1)){
|
||||
$this->air = 200;
|
||||
|
|
|
|||
|
|
@ -12,10 +12,8 @@ abstract class RailBaseBlock extends FlowableBlock //TODO move some methods here
|
|||
if($down->getID() !== AIR and $down instanceof SolidBlock){
|
||||
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
if(RailBlock::$shouldconnectrails){
|
||||
$logic = new RailLogic($this);
|
||||
$logic->place(false, true);
|
||||
}
|
||||
$logic = new RailLogic($this);
|
||||
$logic->place(false, true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ class RailBlock extends RailBaseBlock{
|
|||
$this->isSolid = false;
|
||||
}
|
||||
|
||||
public static $shouldconnectrails = true;
|
||||
|
||||
public function updateState(){
|
||||
//$logic = (new RailLogic($this));
|
||||
//if($logic->countPotentialConnections() == 3){
|
||||
|
|
|
|||
|
|
@ -753,7 +753,7 @@ class Utils{
|
|||
public static function readLong($x, $signed = true){
|
||||
$value = "0";
|
||||
if($signed === true){
|
||||
$negative = ((ord($x[0]) & 0x80) === 0x80) ? true : false;
|
||||
$negative = ((ord($x[0]) & 0x80) === 0x80);
|
||||
if($negative){
|
||||
$x = ~$x;
|
||||
}
|
||||
|
|
@ -763,9 +763,9 @@ class Utils{
|
|||
|
||||
for($i = 0; $i < 8; $i += 4){
|
||||
$value = bcmul($value, "4294967296", 0); //4294967296 == 2^32
|
||||
$value = bcadd($value, 0x1000000 * ord(@$x[$i]) + ((ord(@$x[$i + 1]) << 16) | (ord(@$x[$i + 2]) << 8) | ord(@$x[$i + 3])), 0);
|
||||
$value = bcadd($value, 0x1000000 * ord($x[$i] ?? 0) + ((ord($x[$i + 1] ?? 0) << 16) | (ord($x[$i + 2] ?? 0) << 8) | ord($x[$i + 3] ?? 0)), 0);
|
||||
}
|
||||
return ($negative === true ? "-" . $value : $value);
|
||||
return ($negative ? "-$value" : $value);
|
||||
}
|
||||
|
||||
public static function writeLLong($value){
|
||||
|
|
|
|||
|
|
@ -356,11 +356,11 @@ class Level{
|
|||
if($e->class === ENTITY_MOB && !$e->isPlayer()){
|
||||
++$this->totalMobsAmount;
|
||||
}
|
||||
if($e->needsUpdate){
|
||||
if($e->isPlayer() || $e->needsUpdate){
|
||||
$e->update();
|
||||
}
|
||||
}
|
||||
if(Entity::$updateOnTick && $server->ticks % 40 === 0){ //40 ticks delay
|
||||
if($server->ticks % 40 === 0){ //40 ticks delay
|
||||
$this->mobSpawner->handle();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ class MobSpawner{
|
|||
|
||||
public function spawnMobs(){
|
||||
$phase = $this->server->api->time->getPhase($this->level);
|
||||
if(self::$spawnAnimals && $phase == "day"){ //Animal
|
||||
if(self::$spawnAnimals && ($phase == "day" || $phase == "sunrise")){ //Animal
|
||||
$type = mt_rand(10, 13);
|
||||
$baby = false; //TODO baby
|
||||
$grassOnly = true;
|
||||
}elseif(self::$spawnMobs && $phase == "night"){ //Monster, true night
|
||||
}elseif(self::$spawnMobs && ($phase == "night" || $phase == "sunset")){ //Monster, true night
|
||||
$type = mt_rand(32, 35);
|
||||
$grassOnly = false;
|
||||
$baby = 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue