readded ability to keep chunks unloaded, fixed entities falling on farmland

This commit is contained in:
GameHerobrine 2024-05-30 03:26:49 +03:00
parent 7bc97cca37
commit 8353607451
4 changed files with 13 additions and 7 deletions

View file

@ -40,12 +40,16 @@ class LevelAPI{
console("[ERROR] Could not load level \"" . $name . "\"");
return false;
}
for($X = 0; $X < 16; ++$X){
for($Z = 0; $Z < 16; ++$Z){
$level->loadChunk($X, $Z);
if(PocketMinecraftServer::$KEEP_CHUNKS_LOADED){
for($X = 0; $X < 16; ++$X){
for($Z = 0; $Z < 16; ++$Z){
$level->loadChunk($X, $Z);
}
}
}
$entities = new Config($path . "entities.yml", CONFIG_YAML);
if(file_exists($path . "tileEntities.yml")){
@rename($path . "tileEntities.yml", $path . "tiles.yml");

View file

@ -11,7 +11,7 @@ class PocketMinecraftServer{
private $serverip, $evCnt, $handCnt, $events, $eventsID, $handlers, $serverType, $lastTick, $memoryStats, $async = [], $asyncID = 0;
public $doTick, $levelData, $tiles, $entities, $schedule, $scheduleCnt, $whitelist, $spawn, $difficulty, $stop, $asyncThread;
public static $FORCE_20_TPS = false;
public static $FORCE_20_TPS = false, $KEEP_CHUNKS_LOADED = true;
function __construct($name, $gamemode = SURVIVAL, $seed = false, $port = 19132, $serverip = "0.0.0.0"){
$this->port = (int) $port;
$this->doTick = true;
@ -90,13 +90,15 @@ class PocketMinecraftServer{
"16x16x16_chunk_sending" => false,
"experimental-mob-ai" => false,
"force-20-tps" => false,
"enable-mob-pushing" => Living::$entityPushing
"enable-mob-pushing" => Living::$entityPushing,
"keep-chunks-loaded" => self::$KEEP_CHUNKS_LOADED
]);
Player::$smallChunks = $this->extraprops->get("16x16x16_chunk_sending");
Living::$despawnMobs = $this->extraprops->get("despawn-mobs");
Living::$despawnTimer = $this->extraprops->get("mob-despawn-ticks");
Living::$entityPushing = $this->extraprops->get("enable-mob-pushing");
self::$FORCE_20_TPS = $this->extraprops->get("force-20-tps");
self::$KEEP_CHUNKS_LOADED = $this->extraprops->get("keep-chunks-loaded");
PocketMinecraftServer::$SAVE_PLAYER_DATA = $this->extraprops->get("save-player-data");
MobController::$ADVANCED = $this->extraprops->get("experimental-mob-ai");
Explosion::$enableExplosions = $this->extraprops->get("enable-explosions");

View file

@ -184,7 +184,7 @@ class TileNavigator
}
if($closestToTarget != null){
return $this->reconstructPath($path, $closestToTarget);
return $this->reconstructPath($path, $closestToTarget);
}
return null;

View file

@ -17,7 +17,7 @@ class FarmlandBlock extends TransparentBlock{
}
public static function getCollisionBoundingBoxes(Level $level, $x, $y, $z, Entity $entity){
return [new AxisAlignedBB($x, $y, $z, $x + 1, $y + 0.9375, $z + 1)];
return [new AxisAlignedBB($x, $y, $z, $x + 1, $y + 1, $z + 1)];
}
public static function fallOn(Level $level, $x, $y, $z, Entity $entity, $fallDistance){