Merge branch 'next-minor' into next-major

This commit is contained in:
Dylan K. Taylor 2022-11-13 14:32:54 +00:00
commit 613ce251c5
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 53 additions and 2 deletions

View File

@ -65,3 +65,28 @@ Released 7th November 2022.
- Console reader subprocess should now automatically die if the server main process is killed, instead of persisting as a zombie.
- `ConsoleCommandSender` is no longer responsible for relaying broadcast messages to `MainLogger`. A new `BroadcastLoggerForwarder` has been added, which is subscribed to the appropriate server broadcast channels in order to relay messages. This ensures that chat messages and command audit messages are logged.
- `DelegateInventory` now uses `WeakReference` to track its inventory listener. This allows the delegate to be reused.
# 4.11.0-BETA2
Released 13th November 2022.
## Configuration
- The `chunk-ticking.per-tick` setting is now deprecated, and will be removed in a future release.
- The functionality of this setting has been removed, since it caused more problems than it solved.
- Setting it to zero will still disable chunk ticking (for now), but this should now be done by setting `chunk-ticking.tick-radius` to `0` instead.
## Gameplay
- Improved chunk random ticking:
- Removed the limit on chunks ticked per tick, and its associated config option is no longer respected.
- This change significantly improves crop and plant growth with large numbers of players, but may cause higher CPU usage.
- This limit was causing a linear decrease in chunk ticking speed with larger numbers of players, leading to worsened gameplay experience.
- Every chunk within the configured tick radius of a player will be ticked. Previously, chunks were randomly selected from the radius.
- Implemented Darkness effect.
## API
### `pocketmine\world`
- The following new API methods have been added:
- `public World->getChunkTickRadius() : int` - returns the world's simulation radius
- `public World->setChunkTickRadius(int $radius) : void` - sets the world's simulation radius
## Internals
- Non-arrow projectile damage is now unscaled. Scaling according to velocity is only applied to arrows. This currently doesn't cause any observable change in behaviour, but is required for future additions.

View File

@ -1127,6 +1127,21 @@ class World implements ChunkManager{
unset($this->randomTickBlocks[$block->getStateId()]);
}
/**
* Returns the radius of chunks to be ticked around each ticking chunk loader (usually players). This is referred to
* as "simulation distance" in the Minecraft: Bedrock world options screen.
*/
public function getChunkTickRadius() : int{
return $this->chunkTickRadius;
}
/**
* Sets the radius of chunks ticked around each ticking chunk loader (usually players).
*/
public function setChunkTickRadius(int $radius) : void{
$this->chunkTickRadius = $radius;
}
private function tickChunks() : void{
if($this->chunkTickRadius <= 0 || count($this->tickingLoaders) === 0){
return;
@ -1137,12 +1152,23 @@ class World implements ChunkManager{
/** @var bool[] $chunkTickList chunkhash => dummy */
$chunkTickList = [];
$centerChunks = [];
$selector = new ChunkSelector();
foreach($this->tickingLoaders as $loader){
$centerChunkX = (int) floor($loader->getX()) >> Chunk::COORD_BIT_SIZE;
$centerChunkZ = (int) floor($loader->getZ()) >> Chunk::COORD_BIT_SIZE;
$centerChunkPosHash = World::chunkHash($centerChunkX, $centerChunkZ);
if(isset($centerChunks[$centerChunkPosHash])){
//we already queued chunks in this radius because of a previous loader on the same chunk
continue;
}
$centerChunks[$centerChunkPosHash] = true;
foreach($selector->selectChunks(
$this->chunkTickRadius,
(int) floor($loader->getX()) >> Chunk::COORD_BIT_SIZE,
(int) floor($loader->getZ()) >> Chunk::COORD_BIT_SIZE
$centerChunkX,
$centerChunkZ
) as $hash){
World::getXZ($hash, $chunkX, $chunkZ);
if(!isset($chunkTickList[$hash]) && isset($this->chunks[$hash]) && $this->isChunkTickable($chunkX, $chunkZ)){