- Remove unnecessary null checks for blockLayer and liquidLayer (they are now non-nullable)
- Deduplicate code by scanning both layers in a single loop
- Simplify logic flow by checking palettes first before scanning blocks
- Use the same pattern as ChunkSerializer by building an array of non-empty layers
- Cleaner and more maintainable code with fewer changes from original
- Remove inline comment for cleaner appearance
- Remove deprecated getBlockLayers() method that was replaced by getBlockLayer() and getLiquidLayer()
- Remove setBlockLayer() and setLiquidLayer() setter methods as layers are now managed internally
- Simplifies the API and prevents external mutation of internal layer state
- Add isBlockLayerEmpty() and isLiquidLayerEmpty() methods to SubChunk to avoid code duplication
- Update ChunkSerializer to use emptiness checks instead of null checks for layers
- Update LevelDB to use the new helper methods for cleaner code
- Ensures consistent emptiness checking logic across all serializers
- Check if layers are empty (bitsPerBlock == 0 and value == emptyBlockId) instead of null when saving subchunks
- This aligns with the refactored SubChunk class that now uses non-nullable blockLayer and liquidLayer fields
- Changed SubChunk constructor to accept null for layers and initialize empty PalettedBlockArray internally
- Updated all SubChunk getters to return non-nullable PalettedBlockArray
- Modified serialization/deserialization logic to check for layer emptiness instead of null
- Updated all SubChunk constructor calls across codebase to pass null for empty layers
- Simplified code by removing unnecessary null checks throughout the codebase
- Updated tests to match new SubChunk API
Replace blockLayers array with individual blockLayer and liquidLayer fields.
Update constructor and all usages throughout the codebase.
Deprecate getBlockLayers() method for backward compatibility.
this has bothered me for ages since it sorts into some absurd order by default due to the name starting with the day of the week.
this way it'll ensure that the files are always alphanumerically ordered, which means the most recent crashdump should always be
at the bottom.
MS is due to remove the non-server-auth versions of all of this stuff.
Fortunately v3 server auth movement works just fine without any changes,
although we will need to start sending player tick in some packets if
someone wants to actually use the rewind stuff.
these would previously generate a new line for every error.
since errors are often repeated for different offsets (e.g. different states of the same block),
we can save a lot of spam by deduplicating them and telling which offsets the errors occurred in.
this can happen if the old item had a lower max damage than the new one, and the new
one has a damage higher than the old one's max damage.
it can also happen if the damage was overridden to some illegal value by a custom item
as seen in https://crash.pmmp.io/view/12754811
fixes#6709
we really need a better way to reverse-engineer the chance parameter for these
as the wiki just gives a probability table, which is quite tiresome to extract
patterns from.
PlayerRespawnAnchorUseEvent is also added with options SET_SPAWN and EXPLODE, which allows plugins to customise the outcome of using the anchor in PM, which currently doesn't support dimensions. The event is also cancellable.
- `AsyncGeneratorExecutor` class added that encapsulates the logic of generating chunks using async tasks as previously
- `GeneratorExecutor` interface added that can be implemented to provide chunks in other ways
- `SyncGeneratorExecutor` which invokes the generator directly on the main thread, useful for simple generators like `Flat` where async tasks are not needed
- Some redundant APIs were removed from `World` (these will probably come back as deprecated stubs for the remainder of 5.x, but I was having too much fun deleting code)
- Removed internal `World->registerGeneratorToWorker()` (no longer useful)
- `World` now invokes generator executor instead of posting AsyncTasks directly
- Some internal classes moved to `pocketmine\world\generator\executor` (PopulationTask excluded because plugins use it in lieu of being able to regenerate chunks
- Generators can opt into main-thread execution by setting the `$fast` parameter to `true` in `GeneratorManager::register()`
API additions need to wait for the next minor release
Revert "Entity: make stepHeight accessable (#6702)"
This reverts commit 5527a0c6bf4343b39cd6ed4526f75539ac6ddf19.