Dylan K. Taylor
4ea5401d72
World->getHighestBlockAt() now throws an exception instead of returning -1 in ungenerated terrain
2020-11-26 19:44:22 +00:00
Dylan K. Taylor
fd99445c5b
World->getSafeSpawn() now throws if the target is in ungenerated terrain, instead of silently returning the default
...
this WILL cause crashes in some cases on slower machines (#2724 ), but it's
better than randomly spawning at the top of the map.
2020-11-26 19:36:37 +00:00
Aericio
b2765f32e9
Implemented Barrels, closes #3672
2020-11-16 17:26:07 +00:00
Dylan K. Taylor
6cf875ca3a
Item: rename onActivate() to onInteractBlock()
2020-11-09 19:33:13 +00:00
Dylan K. Taylor
66955d4b99
World: make loadChunk() more useful, drop useless proxy function getOrLoadChunk()
2020-11-09 13:41:46 +00:00
Dylan K. Taylor
3bf87378ef
Merge branch 'stable'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/VersionInfo.php
# src/pocketmine/level/LevelTimings.php
2020-11-08 19:44:30 +00:00
Dylan K. Taylor
64afb6f2e2
Move responsibility of firing chunk requests from World to NetworkSession
...
this is, after all, all about sending chunks ...
2020-11-08 14:14:43 +00:00
Dylan K. Taylor
4b46549cd1
fix PHPStan failure
...
setDirtyFlag has a void return type, so PHPStan assumes it's non-pure and invalidates the type info.
2020-11-05 14:35:23 +00:00
Dylan K. Taylor
058a3b3fa6
relocate some world-specific logic from Chunk to World
2020-11-05 14:28:36 +00:00
Dylan K. Taylor
8762d44506
World: skip lighting updates on chunks which are not yet light populated
2020-11-04 17:50:16 +00:00
Dylan K. Taylor
a05f67bc77
Position::fromObject() world parameter is now mandatory (although still nullable)
2020-11-03 14:33:26 +00:00
Dylan K. Taylor
5cc2a9c3dd
World: rename getChunkAtPosition() to getOrLoadChunkAtPosition()
...
this more accurately reflects what it does.
2020-11-03 14:12:47 +00:00
Dylan K. Taylor
2e9b2d4aae
World: fixed false unload events firing on chunk replacement when tiles and entities are deleted
2020-11-01 17:41:58 +00:00
Dylan K. Taylor
61112e4912
World: make create params of loadChunk and getOrLoadChunk mandatory
...
differences in the default values almost caused me to miss some bugs while trying to remove them.
2020-11-01 17:36:56 +00:00
Dylan K. Taylor
0bb37b5065
World: formalize setBlockAt()'s refusal to modify un-generated chunks
...
closes #2631
2020-11-01 17:24:09 +00:00
Dylan K. Taylor
b7690fed04
BiomeSelector: replace phpdoc with typehints
2020-11-01 17:09:10 +00:00
Dylan K. Taylor
1f2bc8cb69
World: remove rogue import
2020-11-01 17:05:57 +00:00
Dylan K. Taylor
0ae17af1e0
BiomeRegistry: fixed EOF newline
2020-11-01 16:53:42 +00:00
Dylan K. Taylor
4231bfdc7e
Relocate biome ID constants to pocketmine\data\bedrock package
2020-11-01 16:53:06 +00:00
Dylan K. Taylor
b176f4c12f
Switch to BiomeRegistry
...
I accidentally committed this in c869a7f099237ca189dc574fe3df6e7630eeec51 and didn't notice. I intended to use it and never noticed.
2020-11-01 16:47:13 +00:00
Dylan K. Taylor
f991961d9a
Generator no longer requires a ChunkManager to construct
...
this allows injection of arbitrary ChunkManagers into a single Generator instance.
The objective here was to remove the requirement to cache a SimpleChunkManager instance in worker-local storage, because that requires that the chunks it stores be manually removed to avoid memory leaks. However, there are some other obstacles, primarily the worldHeight which is not retained anywhere else.
2020-11-01 16:34:56 +00:00
Dylan K. Taylor
315962c12c
Added __clone() for Chunk and SubChunk
...
we need this because the flatworld generator uses clone to produce new chunks, so we don't want the chunks getting fucked up.
2020-11-01 16:14:25 +00:00
Dylan K. Taylor
1d551af54a
Merge remote-tracking branch 'origin/stable'
...
# Conflicts:
# resources/vanilla
# src/pocketmine/level/Level.php
# src/pocketmine/level/format/Chunk.php
# tests/phpstan/configs/l7-baseline.neon
2020-11-01 15:58:16 +00:00
Dylan K. Taylor
2684ee96f7
World: do not perform base lighting calculation on non-generated chunks
...
this was causing twice as many light calculations for freshly generated chunks.
2020-11-01 15:53:50 +00:00
Dylan K. Taylor
ef542880de
WorldManager: allow different World instances to have different AsyncPool instances
...
instead of being forced to use the Server async pool
right now the intent of this is to reduce (and ultimately eliminate) the dependency of World on Server, but it might come in useful for other stuff too, for example a chunkserver-based generator implementation which blocks on network instead of eating CPU (it would just waste CPU for other tasks).
2020-11-01 15:21:15 +00:00
Dylan K. Taylor
11434f3a27
World::setBiomeId() now bails when trying to modify a non-generated chunk (or chunk locked for generation)
2020-11-01 15:00:48 +00:00
Dylan K. Taylor
d6d9dde0b2
imports cleanup
2020-11-01 14:23:21 +00:00
Dylan K. Taylor
73a8c90bee
Merge remote-tracking branch 'origin/stable'
...
# Conflicts:
# resources/vanilla
# src/world/Explosion.php
# tests/phpunit/item/ItemTest.php
# tests/phpunit/world/format/io/region/RegionLoaderTest.php
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
# tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
2020-11-01 14:21:47 +00:00
Dylan K. Taylor
c1a451f3b1
SubChunkExplorer: ditch subChunkChangeFunc
...
this is better implemented by checking the moveTo() result, which also won't have circular dependencies.
2020-10-31 23:46:27 +00:00
Dylan K. Taylor
817372c55b
SkyLightUpdate: make heightmap calculation routines pure
2020-10-31 23:42:32 +00:00
Dylan K. Taylor
c39a1407a2
Move heightmap calculation logic to SkyLightUpdate
2020-10-31 23:34:04 +00:00
Dylan K. Taylor
59a3e8c096
BiomeArray: added ::fill()
2020-10-31 23:22:42 +00:00
Dylan K. Taylor
4549522289
Rename Chunk::getSubChunkChecked() -> getSubChunk()
2020-10-31 23:12:03 +00:00
Dylan K. Taylor
e09d78238f
Removed EmptySubChunk and SubChunkInterface
2020-10-31 23:10:31 +00:00
Dylan K. Taylor
13d7b7ee1a
Removed final remaining usages of Chunk::getSubChunk()
...
this clears the way to get rid of EmptySubChunk.
2020-10-31 23:07:36 +00:00
Dylan K. Taylor
f50be1ba63
Chunk: Use getSubChunkChecked() in getFullBlock()
2020-10-31 23:06:12 +00:00
Dylan K. Taylor
bacfcf258e
World: remove unused function
2020-10-31 23:00:27 +00:00
Dylan K. Taylor
8ee70dc30a
SimpleChunkManager: fix missing mask in getBlockAt()
2020-10-31 22:55:56 +00:00
Dylan K. Taylor
01001dca74
Use Chunk::getSubChunkChecked() in places where we know that an invalid coordinate cannot be requested
2020-10-31 22:48:41 +00:00
Dylan K. Taylor
b270029161
Rename Chunk::getWritableSubChunk() -> Chunk::getSubChunkChecked()
...
this is not specific to 'writable', it's just an opt-in to checked bounds so that an EmptySubChunk will never be received.
2020-10-31 22:46:33 +00:00
Dylan K. Taylor
5701e733cc
World: fixed a crash in getFullBlock() when used on ungenerated terrain
2020-10-31 22:36:12 +00:00
Dylan K. Taylor
f5807ac049
World::getBlockAt() now doesn't assume that AIR has a fullStateId of 0
2020-10-31 22:22:02 +00:00
Dylan K. Taylor
d0470a80ab
SimpleChunkManager: remove post-mature optimisation
...
these methods are not used in hot paths and are inherently slow anyway, not to mention the introduction of morton codes eliminating the hashtable indexing problem.
2020-10-31 22:02:36 +00:00
Dylan K. Taylor
ddda2d1e64
Remove $create parameter from ChunkManager::getChunk()
...
this restores SimpleChunkManager's behaviour to PM3, removing the need for GeneratorChunkManager (although I'm dubious whether SubChunkExplorer makes any sense in there any more now that we have morton in the mix).
2020-10-31 21:54:51 +00:00
Dylan K. Taylor
dec235abab
World: don't create a new chunk just to read biome info
...
the chunk won't be generated, so we can provide the default result without creating a new chunk for no reason.
2020-10-31 21:29:39 +00:00
Dylan K. Taylor
de867f1b86
World: don't create an empty chunk just for accessing the highest block
...
this is pointless since the chunk will not be generated anyway, so it serves no end to create it.
2020-10-31 21:27:16 +00:00
Dylan K. Taylor
f0d62cf4ce
World: don't try to load chunks to read light levels
...
sync chunk load is useless here because lighting isn't immediately calculated anyway and it isn't available directly from the chunk when loaded.
2020-10-31 20:38:15 +00:00
Dylan K. Taylor
68f5eada32
added fire extinguishing sound, closes #2777
2020-10-31 20:18:06 +00:00
Dylan K. Taylor
5f7b0994b9
World: rename get(HighestAdjacent)BlockSkyLight(At) to make it clear these are **potentials**, not the actual light level
2020-10-31 16:47:34 +00:00
Dylan K. Taylor
241a50387b
World: added getHighestAdjacentRealBlockSkyLight()
...
this is the same as its 'non-real' counterpart, but it accounts for time of day.
2020-10-31 16:44:42 +00:00