Commit Graph

974 Commits

Author SHA1 Message Date
Dylan T
f047ecfd2d Fixed player spawning in ungenerated terrain (#4087)
fixes #4044
fixes #2724

this is significantly more complex than I hoped for, but it's a start... and it works.
2021-03-26 21:36:27 +00:00
Dylan K. Taylor
64886707b2 SubChunkExplorer: avoid repeated shift-right instructions 2021-03-25 23:36:10 +00:00
Dylan K. Taylor
5e9ce92b55 Explosion: don't depend on air having stateID 0 2021-03-25 23:17:33 +00:00
Dylan K. Taylor
0d775f8731 Require ext-chunkutils2 at ^0.2.0 2021-03-23 22:23:17 +00:00
Dylan K. Taylor
aa8c13ec45 Remove dynamic LightArray constants
sad, no constexpr functions :(
2021-03-23 20:23:56 +00:00
Dylan K. Taylor
49438d360d RegistryUtils: generate ordered doc comments
this makes things easier to find, especially in the large ones like VanillaBlocks.
2021-03-22 16:16:28 +00:00
Dylan K. Taylor
90161f24e3 Added script to update registry/enum docblocks 2021-03-22 16:00:09 +00:00
Dylan K. Taylor
a515b5e1b8 World: remove dead constant Y_MASK 2021-03-19 21:13:56 +00:00
Dylan K. Taylor
5dd0b3ac35 OOOPS
it's a bit too early for this
2021-03-19 21:12:46 +00:00
Dylan K. Taylor
c092a2e836 Separate TickingChunkLoader from ChunkLoader
this makes it possible to keep chunks loaded without ticking them.
2021-03-18 23:19:27 +00:00
Dylan K. Taylor
d1387ebd0a World: assume that the primary active chunk is not NULL in generateChunkCallback() 2021-03-18 21:56:17 +00:00
Dylan K. Taylor
34bb225566 World: rename some poorly-named fields 2021-03-18 21:33:17 +00:00
Dylan K. Taylor
eb9a68edee Further refactors to prepare for y=-64 lower limit 2021-03-18 00:08:16 +00:00
Dylan K. Taylor
b844c4266d Added World::Y_MIN
preparation for Y axis expansion in 1.17
2021-03-17 23:19:49 +00:00
Dylan K. Taylor
5a59afbe2c Place world conversion backups in <pwd>/backups/worlds instead of <pwd>/world_conversion_backups 2021-03-17 01:21:11 +00:00
Dylan K. Taylor
72de45f0e9 Drop pocketmine/uuid for ramsey/uuid 2021-03-16 23:03:00 +00:00
Dylan K. Taylor
a49ee0d6b0 World: mark addTile() and removeTile() as @internal 2021-02-24 23:42:09 +00:00
Dylan K. Taylor
9a1cef0d4f Merge branch 'stable' 2021-02-11 22:35:33 +00:00
Dylan K. Taylor
c21ec614fc Fixed PHPStan 0.12.74 error in WorldManager 2021-02-11 16:54:14 +00:00
Dylan K. Taylor
561fc62232 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	.github/workflows/main.yml
#	resources/vanilla
#	src/pocketmine/VersionInfo.php
#	src/world/format/io/region/RegionLoader.php
2021-02-03 17:32:47 +00:00
Dylan K. Taylor
3e1ac66abf Merge branch 'stable' 2021-02-02 13:46:29 +00:00
Dylan K. Taylor
5a1131d72d Populator: require dependencies explicitly, don't make bad assumptions about fields
this also leaks ChunkManagers on the worker threads because the generator context is long-lived.
2021-01-27 21:08:46 +00:00
Dylan K. Taylor
bbae02264d Merge branch 'stable' 2021-01-27 20:04:13 +00:00
Dylan K. Taylor
269a389a97 BlockTransaction: added phpstan return type info for getBlocks() 2021-01-25 18:04:42 +00:00
Dylan K. Taylor
69a829db91 Merge remote-tracking branch 'origin/stable' 2021-01-20 22:16:44 +00:00
Dylan K. Taylor
487b5dd11d Merge branch 'stable' 2021-01-16 19:44:15 +00:00
Dylan K. Taylor
5fa4e284bf Merge branch 'stable' 2020-12-27 19:35:27 +00:00
Dylan K. Taylor
bcc3e87730 Timings: rename core timers to remove 'timer' from the names
this makes them shorter and more consistent.
2020-12-23 17:52:25 +00:00
Dylan K. Taylor
9228f006d4 Merge remote-tracking branch 'origin/stable'
# Conflicts:
#	composer.json
#	composer.lock
#	resources/vanilla
#	src/CrashDump.php
#	src/PocketMine.php
#	src/pocketmine/Server.php
#	src/pocketmine/item/Bucket.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/Chunk.php
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
#	src/pocketmine/level/format/io/region/McRegion.php
#	src/pocketmine/network/mcpe/protocol/BatchPacket.php
#	src/pocketmine/tile/Furnace.php
#	src/pocketmine/utils/UUID.php
#	src/utils/ServerKiller.php
2020-12-20 20:54:13 +00:00
Dylan K. Taylor
1e737644de World: split populateChunk() into two functions
requestChunkPopulation() respects the queue size, orderChunkPopulation() does not.
requestChunkPopulation() should be used for non-essential generation (which mainly includes generation for player use).
orderChunkPopulation() should probably be used by plugins.
2020-12-17 23:49:37 +00:00
Dylan K. Taylor
48623f4e79 World: add additional checks to addEntity() and removeEntity() 2020-12-14 18:55:52 +00:00
Dylan K. Taylor
6f09d472e2 WorldTimings: give timers names that actually make sense 2020-12-13 20:17:46 +00:00
Dylan K. Taylor
1de5fc86c4 PopulationTask: assume that generator has been initialized 2020-12-13 20:00:57 +00:00
Dylan K. Taylor
dd58a95ae5 Move last-known-position tracking to World instead of Entity 2020-12-10 18:28:40 +00:00
Dylan K. Taylor
e925423749 Entity: fix chunk tracking consistency issues, fixed attempted chunk loading in origin world when teleporting to a different position in a different world 2020-12-10 18:13:18 +00:00
Dylan K. Taylor
219cf2126b RegionWorldProvider: make loadRegion() return RegionLoader, fix 3 PHPStan null-reference errors 2020-12-07 19:04:52 +00:00
Dylan K. Taylor
e810a68dd7 Merge branch 'stable'
# Conflicts:
#	build/php
#	composer.lock
#	resources/vanilla
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/level/format/io/region/McRegion.php
2020-12-07 18:57:58 +00:00
Dylan K. Taylor
59cb11dc83 ChunkManager->setChunk() no longer accepts NULL 2020-12-05 18:54:30 +00:00
Dylan K. Taylor
b6df5b974d World->getHighestBlockAt() may still return -1 if the queried column of blocks is all air 2020-12-05 18:14:38 +00:00
Dylan K. Taylor
1f330c0f50 World: ignore entities calling onEntityMoved() who aren't members of the world
this can happen if movement or teleportation occurs during the creation of an entity.
2020-12-05 17:49:34 +00:00
Dylan K. Taylor
a5315991d5 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/network/mcpe/protocol/serializer/PacketSerializer.php
#	src/world/biome/Biome.php
#	tests/phpstan/configs/l8-baseline.neon
2020-12-05 01:30:39 +00:00
Dylan K. Taylor
d728160a77 Removed the cycle between Entity and Chunk
it's now the World's responsibility to manage adding/removing entities from appropriate chunks. Entities no longer know or care that chunks exist.
Entity->checkChunks() remains as-is for backwards compatibility - now it just calls the world to sync its position.
2020-12-05 00:59:16 +00:00
Dylan K. Taylor
1c49cedc8c World: disallow block placement and breaking in unloaded, ungenerated and locked chunks 2020-12-04 15:49:35 +00:00
Dylan K. Taylor
bacdb7bde5 Make sure generator gets preemptively registered when a worker restart is detected
if a PopulationTask took place after the target worker was garbage collected, the population would fail and the chunks it used would be copied for nothing.
This change marks workers as having unregistered generators when detecting that a worker that previously had a generator registered is restarted.
2020-12-04 15:44:17 +00:00
Dylan K. Taylor
5ba09b6a25 fix PopulationTask crash 2020-12-03 23:48:40 +00:00
Dylan K. Taylor
b9cd633cee Chunks no longer exist in un-generated state
a non-generated chunk is now always represented by NULL. This forces the case of ungenerated chunks to be handled by all code, which is necessary because ungenerated chunks cannot be interacted with or modified in any meaningful way.
2020-12-03 22:28:43 +00:00
Dylan K. Taylor
05ab44f768 PopulationTask no longer creates chunks if they don't exist
creating a throwaway empty chunk on the main thread is pointless.
2020-12-03 22:12:42 +00:00
Dylan K. Taylor
c808095978 Chunks no longer contain their own coordinates 2020-12-03 21:59:30 +00:00
Dylan K. Taylor
1f5998d24c FastChunkSerializer no longer encodes chunk coordinates
in cases like PopulationTask it makes more sense to store the coordinates separately where they can be stored more efficiently (once instead of 9 times)
In addition, PopulationTask shouldn't need to serialize an empty chunk just to copy coordinates.

I've made changes like this in other areas already in preparation for the day when chunks no longer contain their coordinates, so this brings us one step closer to that goal.
2020-12-03 20:52:33 +00:00
Dylan K. Taylor
5b1fa25dff LightPopulationTask: remove useless @var 2020-12-03 20:29:41 +00:00