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
f67ab094f2
fix build
2020-10-31 16:51:14 +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
Dylan K. Taylor
0b92e96e14
Player: set silent flag in spectator
2020-10-31 16:10:02 +00:00
Dylan K. Taylor
8be0c0da0d
Implemented a silent property on entities and Entity->broadcastSound()
...
fixes #3516
2020-10-31 16:07:18 +00:00
Dylan K. Taylor
66edf5a165
Particle::encode() now always returns ClientboundPacket[]
2020-10-31 15:51:17 +00:00
Dylan K. Taylor
5a320f22b7
Sound::encode() now always returns an array
2020-10-31 15:48:46 +00:00
Dylan K. Taylor
0cbc5c9a4a
region: harden handling of ByteArrayTag
...
previously this would just explode if the wrong length of data was given.
2020-10-31 15:37:06 +00:00
Dylan K. Taylor
058bb3a91a
World: do not execute neighbour block updates on unloaded chunks
...
we might also need to delay this if any adjacent chunk is also not loaded, in case the block wants to access adjacent blocks during its neighbour update.
2020-10-29 13:37:14 +00:00
Dylan K. Taylor
cfb9cc8999
fix build failure
2020-10-29 13:22:35 +00:00
Dylan K. Taylor
b079772d32
World: do not include unloaded or unlit chunks in getHighestAdjacentBlock(Sky)Light()
2020-10-29 13:05:25 +00:00
Dylan K. Taylor
3c892182fd
World: change some usages of getOrLoadChunk() to getChunk()
...
these usages don't require getOrLoadChunk() because they already check for unloaded chunks anyway.
2020-10-29 12:57:33 +00:00
Dylan K. Taylor
092a69e415
update phpstan baseline
2020-10-29 12:18:29 +00:00
Dylan K. Taylor
3e1263eb79
Chunk: remove all proxy APIs to lighting information
...
these aren't used by internals and they shouldn't be used by plugins either.
2020-10-29 12:11:06 +00:00
Stephen B
ddc0f137e7
changelog: VanillaEffects -> VanillaEnchantments ( #3884 ) [ci skip]
2020-10-27 21:51:55 +00:00
Dylan K. Taylor
587a4c0095
non-exhaustive updates to changelog [ci skip]
2020-10-27 19:35:03 +00:00
Dylan K. Taylor
797e0996f4
PopulationTask: Do not include light when serializing chunks (either way)
...
non-populated chunks shouldn't be light-populated anyway, but in some cases they are (bug or plugin interference).
chunks which were already populated might get modified by adjacent chunk populations, which should invalidate their lighting because generation doesn't track which blocks were changed, so the whole chunk should be recalculated.
2020-10-27 18:42:30 +00:00
Dylan K. Taylor
1859dac789
Implemented self-contained (pass 1) chunk relighting
...
this doesn't handle propagating light across chunk borders yet, since that's much more complex to implement.
2020-10-27 18:29:32 +00:00
Dylan K. Taylor
014317381f
Sugarcane: deduplicate growth code
...
this also fixes sugarcane attempting to grow past the top of the world (closes #3883 ).
2020-10-27 18:05:41 +00:00
Dylan K. Taylor
0ecd68e4a7
LightUpdate: remove premature optimisation which breaks when mass-update lighting is used
...
when setBlockSkyLightArray/setBlockLightArray was used, currentLightArray would retain a reference to the old light array, which would cause false readings if SubChunkExplorer didn't move away from that subchunk and back.
This causes a small degradation of performance, but I think it can be implemented differently anyway.
This also fixes #3816 .
2020-10-27 18:01:31 +00:00
Dylan K. Taylor
05ab75b5ce
PopulationTask: do not calculate lighting for chunks
...
we do this ondemand now, which means this is just wasting CPU for the vast majority of generated chunks.
2020-10-27 17:03:57 +00:00
Dylan K. Taylor
31c2c3abb5
SubChunkExplorer::moveTo() now returns a status
...
this can be used by SubChunkExplorer subclasses to implement specialized logic.
2020-10-26 16:25:21 +00:00
Dylan K. Taylor
390bc631c8
SubChunk: added moveToChunk()
2020-10-26 16:04:31 +00:00
Dylan K. Taylor
8bab9cc108
RegionWorldProvider: use morton2d directly instead of abusing chunkHash()
...
while these currently do the same thing, it's very confusing and creates an unnecessary dependency on World.
2020-10-26 15:34:32 +00:00
Dylan K. Taylor
d6ed542fcd
Merge remote-tracking branch 'origin/stable' into master
...
# Conflicts:
# composer.json
# composer.lock
# src/CrashDump.php
# src/pocketmine/Server.php
# src/pocketmine/level/format/io/region/McRegion.php
# tests/phpstan/configs/check-explicit-mixed-baseline.neon
# tests/phpstan/configs/l7-baseline.neon
# tests/phpstan/configs/l8-baseline.neon
# tests/travis/setup-php.yml
2020-10-26 16:18:53 +00:00
Dylan K. Taylor
4c0c2ebd24
CS cleanup
2020-10-26 15:56:30 +00:00
Dylan K. Taylor
0b550b346b
imports cleanup
2020-10-26 15:43:25 +00:00
Dylan K. Taylor
3f254bd49c
Separated effects' MCPE ID registration from VanillaEffects
2020-10-24 18:52:20 +01:00
Dylan K. Taylor
cf7f50af06
Fixed test failure
2020-10-24 18:25:42 +01:00
Dylan K. Taylor
c5b925a213
Moved EnchantmentIds to pocketmine/data/bedrock package
2020-10-24 18:24:39 +01:00
Dylan K. Taylor
f3f7ff9237
Enchantment internal IDs are now dynamic
2020-10-24 18:21:31 +01:00
Dylan K. Taylor
47976bac34
Moved enchantment ID handling to pocketmine/data/bedrock package
...
this permits plugins to register their own enchantments mapped to MCPE IDs again.
2020-10-24 17:59:46 +01:00
Dylan K. Taylor
2e1239f77a
EnchantCommand no longer accepts numeric enchantment IDs
2020-10-24 17:33:17 +01:00
Dylan K. Taylor
1424114cf2
Clean phpstan baselines
...
some of these are dead, others are FPs fixed by newer PHPStan versions.
2020-10-24 17:22:49 +01:00
Dylan K. Taylor
a8980a0f67
phpstan 0.12.51
2020-10-24 17:10:31 +01:00
Dylan T
69aa7c5ac1
Support for Composer v2 ( #3880 )
2020-10-24 16:42:38 +01:00
Dylan K. Taylor
11b74868ee
CraftingTransaction: remove impossible condition
...
this is never hit thanks to the logic flow above - recipeItems is never empty.
2020-10-24 11:22:02 +01:00
Dylan K. Taylor
9a53de0903
Utils: explode() never returns an empty array
2020-10-24 11:19:37 +01:00
Dylan K. Taylor
0f8101d4a6
McRegion: Ignore files which don't have a valid file extension
...
previously a file with a 4-letter name ending in 'mca' in the region folder of a PMAnvil world would cause the world format to be unrecognized. This happens because strrpos() returns false when the substring isn't found, which gets coerced to 0 when used in addition.
2020-10-24 11:15:07 +01:00
Dylan K. Taylor
55ecac4c80
Fixed always-true condition in world loading
...
this has a couple of side effects which need to be explored.
- first of all, this bug prevented generateLevel() from filling in the preset from server.properties. With this fix, worlds which don't have any extra generator settings will start to be generated using server.properties settings, which is almost certainly not expected behaviour.
- preset can now be specified separately from generator in pocketmine.yml, which is nicer for users.
2020-10-24 11:10:35 +01:00
Muqsit Rayyan
3b632a8deb
Handle InvalidArgumentException thrown by VanillaEnchantments::fromString ( #3878 )
2020-10-24 06:43:14 +01:00
Dylan K. Taylor
9947e13121
Yank constants out of Enchantment base class
2020-10-23 21:04:27 +01:00
Dylan K. Taylor
a01c086481
Introduced VanillaEnchantments registry
2020-10-23 20:48:19 +01:00
Dylan K. Taylor
e9038336e3
EventPriority: hardcode name -> value mapping instead of using constant()
...
this would have caught fire if additional non-priority constants were added, or if the constants were renamed.
2020-10-23 20:14:37 +01:00
Dylan K. Taylor
f5e033ad5d
AsyncPool: fixed stable merge error
2020-10-23 13:25:52 +01:00
Dylan K. Taylor
23e5ade77e
Merge branch 'stable' into master
...
# Conflicts:
# build/make-release.php
# composer.lock
# resources/vanilla
# src/plugin/PluginDescription.php
# src/pocketmine/entity/Human.php
2020-10-21 16:55:52 +01:00
Dylan K. Taylor
2a1d1e90a2
php-cs-fixer nits
2020-10-21 16:44:57 +01:00
Dylan K. Taylor
286ac2a975
Rework World::blockHash() to use morton3d
...
this uses the unused bits on the Y component to expand the X/Z axes to 2^27 blocks long instead of 2^21 permitted by a regular morton3d code. It does require the sacrifice of an additional bit on the Y axis, but the performance advantages are more than worth it.
I'm exploring how realistic it would be to just eliminate blockHash global usage (currently in lighting updates and explosions). This would allow scaling up to 2^32 without larger hashes (morton2d for chunks).
2020-10-20 20:31:10 +01:00