mirror of
https://github.com/danbulant/flying-squid
synced 2026-06-14 12:01:12 +00:00
add a server setting view-distance, and take the min of that settings and the player settings to get the distance to send chunks
I experimented with vanilla, and its "MultiplayerChunkCache" indicates this behavior for a vanilla server progress on #127
This commit is contained in:
parent
fb5450e3ca
commit
7f47dacc60
2 changed files with 4 additions and 3 deletions
|
|
@ -15,5 +15,6 @@
|
|||
"plugins": {
|
||||
|
||||
},
|
||||
"modpe": false
|
||||
"modpe": false,
|
||||
"view-distance":10
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ module.exports.server=function(serv,{regionFolder,generation={"name":"diamond_sq
|
|||
//serv.pregenWorld(serv.netherworld).then(() => serv.log('Pre-Generated Nether'));
|
||||
};
|
||||
|
||||
module.exports.player=function(player,serv) {
|
||||
module.exports.player=function(player,serv,settings) {
|
||||
|
||||
player.spawnEntity = entity => {
|
||||
player._client.write(entity.spawnPacketName, entity.getSpawnPacket());
|
||||
|
|
@ -151,7 +151,7 @@ module.exports.player=function(player,serv) {
|
|||
player.sendRestMap = () =>
|
||||
{
|
||||
player.sendingChunks=true;
|
||||
player.sendNearbyChunks(player.view,true)
|
||||
player.sendNearbyChunks(Math.min(player.view,settings["view-distance"]),true)
|
||||
.then(() => player.sendingChunks=false)
|
||||
.catch((err)=> setTimeout(() => {throw err;},0));
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue