Commit Graph

1135 Commits

Author SHA1 Message Date
1a2c10e844 World: Fixed getSafeSpawn() not accepting seed positions below y=1 (#5955)
this should have been changed during the introduction of y=-64 minimum world height, but it got missed.
2023-08-02 18:05:16 +01:00
3afe3b7f44 Merge branch 'stable' into minor-next 2023-07-24 12:02:24 +01:00
86810c5e1c LevelDB: clearer error message 2023-07-19 16:31:10 +01:00
b33a9690e9 LevelDB: simplify condition 2023-07-19 16:30:13 +01:00
1b9c282194 LevelDB: tolerate incorrect number of biome palettes, as long as there are enough for each real subchunk
modern versions save 24 exactly, but previous versions saved more. We don't use the excess, so it's not a problem if they are missing, but this is nonetheless non-compliant with vanilla.
2023-07-19 16:29:14 +01:00
82b75e0ccb LevelDB: Remove happy debug message 2023-07-19 15:21:47 +01:00
6c59912ed5 LevelDB: workaround 0 bpb palettes with a length prefix
this was caused by a plugin overriding the world provider.

related:
-  https://github.com/pmmp/PocketMine-MP/issues/5911
-  https://github.com/Refaltor77/CustomItemAPI/issues/68

fixes #5911
2023-07-19 15:19:33 +01:00
537721fe7d Replace Closure::fromCallable() usages with first-class callables
PHP 8.1 <3
2023-07-19 13:34:42 +01:00
2e9a4f2be2 Merge branch 'trees' into minor-next 2023-07-18 12:39:41 +01:00
83d11c7429 Implemented Big & Small dripleaf (#5835) 2023-07-17 16:30:52 +01:00
b7210755a7 1.20.10 2023-07-12 13:39:39 +01:00
3abd592b1f Update to pmmp/BedrockBlockUpgradeSchema@3.0.0 2023-07-03 18:07:51 +01:00
5d51ffdfe3 Merge branch 'minor-next' into trees 2023-07-01 12:25:44 +01:00
8dedbb7471 World: clamp clickVector components from 0-1
this ensures that #5827 won't randomly start crashing if clients give bad values.
2023-06-21 16:59:14 +01:00
eb9f804781 ÂBedrockWorldData: throw less confusing errors on missing version tags 2023-06-19 12:22:50 +01:00
ab75838c89 First shot at implementing acacia trees
this is mostly working, but due to some issue with leaf decay, the edges of the larger canopy will decay within minutes.

I don't know why this is yet, but it's likely some incorrect implementation of Leaves causing the problem.

In addition, the secondary branch of acacia may generate next to the base block of the trunk, which I've never observed to happen in vanilla. This has a 2% chance of occurring, so I haven't been able to rule it out yet, but it probably shouldn't happen.
2023-06-10 18:35:42 +01:00
9a67e3d660 PM5-specific changes for 1.20.0.23 beta 2023-06-07 21:08:41 +01:00
8744032ab6 Fixed empty block handling after blockstate ID XOR change 2023-05-29 18:26:23 +01:00
5a9cdef40c Chunk: added DIRTY_FLAGS_ALL and DIRTY_FLAGS_NONE 2023-05-29 17:45:19 +01:00
a49842278a WorldProvider subsystem no longer depends on Chunk
Instead, it provides the data needed to construct the chunk, which doesn't require the provider to be aware of anywhere near as much logic.
2023-05-29 17:44:00 +01:00
d57954dff0 PopulationTask: ensure that unmodified chunks don't get sent back to the main thread for no reason 2023-05-29 17:30:04 +01:00
ce5e663a73 Assume chunks are dirty by default
having them be clean by default makes no sense. It only makes sense for them to be clean if they were loaded directly from disk without any alterations.

Default clean is a footgun.
2023-05-29 17:22:39 +01:00
c10be0f346 WorldProvider: allow loadChunk() to return additional information about the loaded chunk data
this will be needed for dealing with #5733. I don't plan to fix that before 5.0, but we need to make the appropriate BC breaks now, before release.
2023-05-29 17:03:39 +01:00
f5a1a0c9cb ÂInsert PM data version into blockstates, chunks, entities, tiles and level.dat
this information will allow us to correct for any bugs introduced by past versions.

however, we still need to propagate this information to permit actually using it when loading data.
2023-05-29 16:32:24 +01:00
b8ba2d03ba Added new note instruments up to 1.19
1.20 adds extra ones for each type of mob head, but we're not supporting 1.20 yet.
2023-05-26 16:58:06 +01:00
fddab29e87 Move mob head and note instrument save IDs into pocketmine\data\bedrock
to be consistent, these shouldn't be exposed in the API like this...
I'm not very happy with the whole 'type ID map' paradigm (particularly its lack of static analysis guarantees), but the most important thing right now is to get this stuff out of the API so that plugin devs don't try and abuse it. We're not going to change the whole system days before PM5 release.
2023-05-26 15:47:12 +01:00
edafe9d21f Entity: Rename and document isImmobile() and friends
while I could implement server-side ability to disable entity movement, I don't think that's particularly useful. However, the intended function of this (disabling client sided AI) is useful, so it makes more sense to rename it to match its functionality, rather than changing its functionality to match the name.

closes #3130
2023-05-26 14:01:21 +01:00
ee9ce8a4f4 Merge branch 'minor-next' into major-next 2023-05-17 15:45:03 +01:00
fa719f37d5 Implement Cave Vines & Glow Berries (#5424) 2023-05-08 19:24:23 +01:00
d317347a9b WorldTimings: remove TODO
I tried this, and it didn't really provide any information that the tree table didn't already show.
2023-05-08 16:35:30 +01:00
077fac84bf Added aggregate timers for all world timings
this allows timings list view to display totals for these sections. It does make the tree view a bit more annoying in some cases though.
2023-05-08 16:27:46 +01:00
5c7f4570b4 Merge branch 'minor-next' into major-next 2023-05-06 17:20:37 +01:00
289ede669d BlockTranslator: use less ambiguous function names 2023-05-05 14:47:23 +01:00
2c81446e5b Move TreeType to generator package, added dedicated SaplingType enum
TreeType includes a bunch of stuff that don't have regular saplings associated with them, such as mangrove and azalea trees.
Mangrove has a dedicated propagule block with different behaviour than the others, and azalea trees are grown from azalea blocks, which are solid and have different behaviour to saplings.

We may also want to account for crimson and warped 'trees' in TreeType too, although I'm not sure if those belong there or not.
2023-05-04 16:54:10 +01:00
32e6fdd95a Rename RuntimeBlockMapping -> BlockTranslator 2023-05-03 22:18:27 +01:00
01f340985a Centralize all conversion-related stuff under TypeConverter
instead of having singletons for everything, which are a nightmare to manage for multi version
2023-05-03 16:33:17 +01:00
6beb80b8fe Fixed usages of BlockDataUpgrader which weren't accounting for thrown exceptions 2023-05-02 17:13:31 +01:00
4d0cecbac2 RegionWorldProvider: use provider logger instead of global logger 2023-05-02 16:47:25 +01:00
5fcf5e0c40 LevelDB: log more stuff, stop bailing on recoverable errors 2023-05-02 16:46:45 +01:00
f29e2f7110 WorldProviders now accept Loggers 2023-05-02 15:41:11 +01:00
d0d263191d Fix build 2023-05-02 14:21:33 +01:00
3366e1084b LightUpdate: squeeze 10-15% more performance out of propagation
we can use SubChunkExplorerStatus to decide whether or not to update the local light array reference.

We also dereference some properties into local variables, because dereferencing properties is slow. Indirect property dereferences add an extra performance penalty for every layer.
2023-05-02 14:05:55 +01:00
d0b9234841 SkyLightUpdate: deal with effective light during initial node discovery
this allows the propagation stage to ignore effective light, which allows for further optimisations.
2023-05-01 22:29:31 +01:00
d80f65ae7c BedrockWorldData: do not load worlds with a newer NetworkVersion than we support
often, protocol updates are done without consideration for the current world format version. We don't want to require the world support to be updated at the same time, since this might delay updates.
2023-05-01 17:53:08 +01:00
096daef0d0 World: added setDisplayName()
this is an obvious use case, and I'm not really sure why it wasn't supported sooner.
2023-05-01 16:29:07 +01:00
b3e94ef1dc Chunk: update documentation 2023-05-01 14:46:30 +01:00
07dc10d6e6 World: improve performance of tickChunks() selection process (#5721)
Since light population is required to make a chunk tickable, a chunk may not be tickable for some time if the async workers get backlogged.
The previous version of this system only cached the eligibility result if the result was a "yes", but we can also track it when it's a "no", rather than rechecking it every tick.

This change should improve performance in factions and similar gamemodes, which involve large maps with sparsely distributed players, where each player likely has an independent, non-overlapping ticking chunk circle.

We also ditch TickingChunkEntry in favour of multiple arrays to track the eligibility states. This allows us to avoid rechecking the (even cached) readiness of potentially thousands of chunks. If there are no ticking chunks to recheck, this reduces the cost of the selection process to zero.
2023-04-27 16:59:29 +01:00
a8dec1adb1 PM5-specific changes for 1.19.80 2023-04-26 23:30:56 +01:00
0dca85af44 Merge branch 'minor-next' into major-next 2023-04-26 23:28:27 +01:00
9bfcd39f2a World: improve type info for getTickingChunks() 2023-04-26 17:06:52 +01:00