Dylan K. Taylor
94e16f416d
Added KnownTranslationKeys (generated) and start using it
2021-06-29 22:46:04 +01:00
Dylan T
32d7b1e6af
Start using webmozart/pathutil for joining paths ( #4287 )
2021-06-29 19:40:43 +01:00
Dylan K. Taylor
02fab77e55
World: change 'closed' to 'unloaded'
...
this makes more sense overall from a reader's perspective.
and also provide a rug-jerk for any idiots using World->close() when they aren't supposed to? ....
2021-06-26 21:54:18 +01:00
Dylan K. Taylor
fc70b625b3
ExperienceOrb: Require providing XP value in constructor
2021-06-19 19:42:13 +01:00
Dylan K. Taylor
981b0285d1
Isolate config casting nastiness in one place
...
this doesn't solve the underlying problem, but it does reduce the amount of noise made by PHPStan about it, as well as avoiding code litter.
2021-06-19 19:14:02 +01:00
Dylan K. Taylor
d96fc17339
World: Check placed block collision boxes after place()
...
since we write these into a transaction instead of actually modifying the world directly, we can use the transaction to verify that the placement location is OK before setting the blocks.
closes #4248
2021-06-18 19:07:38 +01:00
Dylan K. Taylor
f1583f44df
LightArray: Avoid allocating 7 useless arrays for every node processed
...
instead, use a const array of the offsets and add them to the coordinates, which avoids the allocations.
In synthetic benchmarks, this method takes 40-50% less CPU time by eliding ZEND_INIT_ARRAY and ZEND_ADD_ARRAY opcodes. In practice, the benefit will likely be much smaller (perhaps even irrelevant).
2021-06-17 22:21:58 +01:00
Dylan K. Taylor
71a4ea2a95
FastChunkSerializer: remove useless variable initialization
2021-06-17 20:59:40 +01:00
Dylan K. Taylor
43f71d0d63
FormatConverter: Copy worlds for backup if rename fails
...
this can fail if the backups directory points to a different drive than the original worlds location. In this case, we have to copy and delete the files instead, which is much slower, but works.
I REALLY advise against putting backups on a different mount point than worlds if you plan to convert large worlds.
2021-06-17 20:46:34 +01:00
Dylan K. Taylor
61c59be299
Replace hardcoded block metadata shifts and masks with constants
...
we might want to make these bigger than 4 bits in the future.
2021-06-16 12:48:09 +01:00
Dylan K. Taylor
e7b21cf9dc
World: remove obsolete TODO comment
...
[ci skip]
2021-05-21 13:10:48 +01:00
Dylan K. Taylor
2ab751f985
World: fixed potential bug scheduling async light updates multiple times
2021-05-21 13:09:38 +01:00
Dylan K. Taylor
e4750ad2cd
WorldTimings: apply native typehints
2021-05-17 23:23:46 +01:00
Dylan K. Taylor
7217ff5ff5
World: added an extra subtiming for random chunk updates
2021-05-17 23:18:56 +01:00
Dylan K. Taylor
4736b5968d
WorldTimings: change some idiotic timer names
2021-05-17 23:14:30 +01:00
Dylan K. Taylor
cdaf734470
World: Clean up ticking chunk loader tracking
2021-05-17 23:07:48 +01:00
Dylan K. Taylor
643c3ed14e
World: Require all adjacent chunks to a ticking chunk candidate to be unlocked, generated, loaded and light-populated
...
this should address the remaining problems with grass spread/death.
2021-05-17 20:59:40 +01:00
Dylan K. Taylor
7abf50f503
World: Extracted a tickChunk() method from tickChunks()
...
most of what's left in tickChunks() is just selecting the chunks, rather than actually ticking them.
2021-05-17 20:54:51 +01:00
Dylan K. Taylor
bab76f4a6e
World: extract some blocks of logic from tickChunks() into their own methods
...
the amount of nested loops, cx/dx/chunkx/etc clusterfuck in this code makes it very difficult to work with...
2021-05-17 20:50:46 +01:00
Dylan K. Taylor
bdce781c6d
Chunk: do not close preexisting tiles in addTile()
...
if it's desired to actually replace a tile, the old tile should be explicitly removed and closed first.
2021-05-12 12:32:36 +01:00
Dylan K. Taylor
b2e806e2fa
World: Harden chunk loading against bad data in entity/tile NBT
2021-05-12 12:26:41 +01:00
Dylan K. Taylor
0ff21557e4
World: fixed generation requests being rejected during resolution
...
when a chunk population is ordered, its only chunk loader is the one that the World installed to keep the chunk loaded while it was generated. So, when the resolver removes its chunk loader from the chunk, it triggers the chunk unloading mechanism, which causes the promise to directly be rejected.
2021-05-10 17:20:04 +01:00
Dylan K. Taylor
2ce6a87d05
getSafeSpawn() may throw if the target terrain is not generated
2021-05-08 16:22:13 +01:00
Dylan K. Taylor
e9f3cefe94
Default world might be null
2021-05-08 16:21:34 +01:00
Dylan K. Taylor
027109075c
WorldManager: don't recalculate the spawn point for every player teleported during world unload
2021-05-08 16:19:22 +01:00
Dylan K. Taylor
624495f4d3
Added a generic Promise type
...
I anticipate increasing demand for promises, and since all the libraries I could find suck, we'll stick to our own impl for now.
2021-05-08 15:57:30 +01:00
Dylan K. Taylor
998a583815
World: Fixed inverted completion callbacks for chunk population
...
this would have caused any chunk populated by a plugin to remain loaded forever.
2021-05-07 23:39:44 +01:00
Dylan K. Taylor
742f86e022
Rename DestroyBlockParticle -> BlockBreakParticle
...
closes #3461
literally every other particle/sound has the subject first, followed by the (optional) verb, and finally Particle (or Sound).
In addition, we refer to breaking blocks as 'break' everywhere except here, where we refer to it as 'destroy'.
2021-05-06 18:33:18 +01:00
Dylan K. Taylor
7b2c6c5ceb
Avoid more $this refs on long-life closures
2021-05-06 14:27:56 +01:00
Dylan K. Taylor
c356abb917
BlockTransaction: remove cyclic reference to self in callbacks
2021-05-06 14:27:08 +01:00
Dylan K. Taylor
4f4069d403
World: remove another noisy debug message
2021-04-19 00:55:42 +01:00
Dylan K. Taylor
caf3ec1b54
World: improve documentation of World::getPotentialBlockSkyLightAt()
2021-04-18 20:31:42 +01:00
Dylan K. Taylor
53ebe4f9f9
World: added getHighestAdjacentFullLightAt()
2021-04-18 20:20:08 +01:00
Dylan K. Taylor
51b0685881
World: document getFullLight() and getFullLightAt()
2021-04-18 20:14:16 +01:00
Dylan K. Taylor
f29ababf8d
World: Rearrange some light-related methods
...
these things are all over the place ...
2021-04-18 20:07:36 +01:00
Dylan K. Taylor
b31b097b8e
LightPopulationTask no longer hard-depends on Server
2021-04-16 15:41:14 +01:00
Dylan K. Taylor
ebd19f5a70
SubChunkExplorer: Protect world field
2021-04-15 23:32:30 +01:00
Dylan K. Taylor
bf67170504
SubChunk: don't assume 15 sky light when not allocated
...
closes #2533
at long last...
2021-04-15 23:22:53 +01:00
Dylan K. Taylor
5d83f4670a
RegionLoader: Switch to using named constructors
...
this makes the code more self-descriptive, and also helps to detect potential bugs.
2021-04-15 21:57:23 +01:00
Dylan K. Taylor
e8dd4de5c8
SubChunk: Lazily allocate LightArrays as needed
...
this is slightly slower, but saves a significant amount of memory (~80 KB per chunk).
Since ext-chunkutils2 doesn't do copy-on-write trickery like the PHP impl did, we need this to get the memory advantages back.
2021-04-15 21:43:46 +01:00
Dylan K. Taylor
e6ecacbb2b
World: do not access chunks for light if they aren't yet light-populated
2021-04-15 21:21:34 +01:00
Dylan K. Taylor
ab9615fb9c
World: fixed documentation for getHighestAdjacentPotentialBlockSkyLight()
...
[ci skip]
2021-04-15 21:19:58 +01:00
Dylan K. Taylor
9655cb819d
World: Remove duplicated code
2021-04-15 19:41:03 +01:00
Dylan K. Taylor
a0c3102b05
FormatConverter: add @phpstan-param for newProvider ctor parameter
2021-04-15 19:14:52 +01:00
Dylan K. Taylor
8e3f5737a0
RegionWorldProvider: fix CS
2021-04-15 15:39:08 +01:00
Dylan K. Taylor
32c4a165cf
Removed RegionLoader::open()
...
this is nothing but a source of bugs.
2021-04-15 15:38:18 +01:00
Dylan K. Taylor
edb590f681
missed one ...
2021-04-15 15:23:15 +01:00
Dylan K. Taylor
08f0c9a244
Separate writable parts of RegionWorldProvider into WritableRegionWorldProvider
2021-04-15 15:20:57 +01:00
Dylan K. Taylor
e6fb6b1f27
BaseLevelProvider: Remove obsolete proxy methods
2021-04-15 15:15:16 +01:00
Dylan K. Taylor
dc5b1efa66
Merge remote-tracking branch 'origin/stable'
2021-04-15 14:04:27 +01:00