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
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
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
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
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
203cc7fcef
World: Removed noisy debug message
2021-04-13 22:32:00 +01:00
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
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
a49ee0d6b0
World: mark addTile() and removeTile() as @internal
2021-02-24 23:42:09 +00:00
Dylan K. Taylor
bbae02264d
Merge branch 'stable'
2021-01-27 20:04:13 +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
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
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
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
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
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
999defd20d
World: remove create params from loadChunk() and loadChunkAtPosition()
2020-12-03 18:49:14 +00:00
Dylan K. Taylor
a67f0d1f75
World->registerChunkLoader() no longer causes creation of an empty chunk
...
this only made sense to work around the server crashing when creating a player in ungenerated terrain, but spawning at y=256 is hardly preferable, and it'll crash since fd99445c5b
anyway ...
2020-12-03 18:41:53 +00:00
Dylan K. Taylor
ec2feeffcb
World->populateChunk() no longer causes ChunkLoadEvent to fire with an empty chunk
...
instead, it will fire when the chunk comes out of PopulationTask and is set into the world using setChunk().
There is still one place left where auto-creation of empty chunks is used by the core, and that's an issue i'm still deciding how to deal with.
2020-12-03 18:23:03 +00:00
Dylan K. Taylor
fa9be2477d
World: do not fire ChunkListener->onChunkChanged() when a new chunk is set
...
the documentation expressly describes a chunk being _replaced_ by a new chunk. This doesn't fit when the chunk didn't exist to begin with.
2020-12-03 18:20:43 +00:00