Dylan K. Taylor
88d83e0fca
AsyncPool: Lazy-start AsyncWorkers when they are needed only
...
This changes how the AsyncPool works so that it does not immediately always start all of the workers in the pool.
Instead, workers will be started only when an idle worker was not found.
This allows for significant memory footprint reductions while idle.
In effect the async-workers setting in pocketmine.yml now dictates a _maximum_ pool size, not a fixed pool size.
2018-06-11 10:23:46 +01:00
Dylan K. Taylor
4b221c0601
OceanBiome: don't inherit from GrassyBiome, change ground cover to gravel
2018-06-11 09:58:48 +01:00
Dylan K. Taylor
e867427f71
Leaves: remove useless $check parameter
...
this is only written to and never read from.
2018-06-10 17:20:34 +01:00
Dylan K. Taylor
c4c6c58615
Added some missing typehints
2018-06-10 17:18:55 +01:00
Dylan K. Taylor
89643ff9af
MainLogger: Added getFormat() and setFormat()
...
this allows plugins to easily alter the output of the console logger.
2018-06-10 10:49:12 +01:00
Dylan K. Taylor
9657d50aeb
MainLogger: workaround --disable-ansi not being respected on other threads
2018-06-10 10:24:49 +01:00
Dylan K. Taylor
3725bea3e5
AsyncPool: Slightly reduce worker memory usage with more conservative start options
...
this results in a memory footprint reduction of maybe 4MB for a total of 8 workers. Not much, but it's something.
2018-06-10 10:18:07 +01:00
Dylan K. Taylor
f3a84b332b
Updated RakLib and SPL dependencies, allow any 0.3.x SPL
2018-06-09 20:13:27 +01:00
Dylan K. Taylor
f6481eab8f
Implemented an InventoryEventProcessor, fixes #1986 ( #2176 )
...
* Implemented InventoryEventProcessor, fixes #1986
Event processors can now be registered and unregistered at will. Entity inventory/armor change events are now handled by event processors instead of the inventories themselves, which allows enabling/disabling the calling of these events at will.
This now avoids stupid things happening when initializing inventory contents, since the callers for those events are now registered _after_ the contents are initialized.
2018-06-09 17:37:10 +01:00
Dylan K. Taylor
8e5aca70b4
Entity: Avoid using close() during initEntity()
...
this simply conceals bugs and will cause astonishing behaviour.
2018-06-09 17:06:15 +01:00
Dylan K. Taylor
85136b7b4a
Entity: Attach to level & chunk after initEntity() call, not before
...
this avoids leaving garbage entities attached to chunks when exceptions are thrown during initEntity().
2018-06-09 16:59:22 +01:00
Dylan K. Taylor
47742d74c8
Player: Drop load queue on level switch
...
This ensures that the player doesn't request bad chunks if it was teleported from an invalid level.
2018-06-09 16:21:41 +01:00
Dylan K. Taylor
ca54c8d78e
Merge branch 'master' of https://github.com/pmmp/pocketmine-mp
2018-06-09 16:21:01 +01:00
Dylan K. Taylor
601811f0f8
Player: Account for the possibility of Level being null in switchLevel()
...
the Entity base also accounts for this, and assuming that this is automatically valid is causing lots of crashes. I am not sure of the circumstances under which this is suddenly becoming null, but this shouldn't assume that the level is valid nonetheless.
2018-06-09 16:20:51 +01:00
Anton
aeb551b317
Remove double use of spl_object_hash ( #2226 )
2018-06-09 14:15:50 +01:00
Dylan K. Taylor
37b445f210
Updated Math dependency
2018-06-09 13:05:25 +01:00
Dylan K. Taylor
d04991feb6
Level: Avoid chunk sending bugs caused by duplicate chunks with wrong coordinates
...
If the same chunk is set into multiple different places in the world, the chunk's position is no longer able to be relied on, because it will have the position of the last place it was set. This results in chunks not getting sent correctly when the same chunk is set in multiple places.
This avoids the bug by using known valid coordinates (using chunk hashes) to establish the real coordinates, and also adds an assert to notify developers should they unintentionally set a duplicate chunk by mistake.
2018-06-09 11:25:45 +01:00
Dylan K. Taylor
c327b3d2c4
AsyncPool: be less dependent on Server in the code
...
The goal is to remove the Server things from here completely.
2018-06-08 20:08:23 +01:00
Dylan K. Taylor
af69418a55
PlainBiome: reduce maximum elevation
2018-06-08 13:04:45 +01:00
Dylan K. Taylor
8cd311bcb4
GroundCover: don't replace liquid with can-be-flowed-into blocks
...
fixes snow layers generating underwater
2018-06-08 11:15:19 +01:00
Dylan K. Taylor
78ec3937bf
BiomeSelector: drastically simplified implementation and made more robust
...
- Doesn't need to be pre-populated with biomes prior to calculating the heatmap - now population of biomes is entirely dependent on the lookup function, improving consistency
- Uses an abstract class method for lookup instead of callback (use anonymous class instead)
- Faster because the heatmap is directly populated with biomes instead of biome IDs, removing an unnecessary lookup.
2018-06-08 10:19:08 +01:00
Dylan K. Taylor
4e3e807741
Biome: Added UnknownBiome class to avoid astonishing behaviour on unknown biomes
2018-06-08 10:19:08 +01:00
Dylan K. Taylor
8c6161a4f2
Biome: make biomes list use an SplFixedArray
2018-06-08 10:19:08 +01:00
Dylan K. Taylor
c8a87b14d5
PopulationTask: actually fix locks not getting released in generation errors
2018-06-07 23:53:59 +01:00
Dylan K. Taylor
8fca7cc68d
Apply some typehints to generators
2018-06-07 20:22:35 +01:00
Dylan K. Taylor
45f940681a
Make Normal->pickBiome() private
2018-06-07 20:21:26 +01:00
Dylan K. Taylor
e3c97d7d5e
Flat: clean up more garbage
2018-06-07 20:18:04 +01:00
Dylan K. Taylor
172abef2a7
Flat: clean up generation of base chunk
2018-06-07 20:11:29 +01:00
Dylan K. Taylor
709abb02e6
Generator: remove more dead incomplete code
...
again, this can be added when and if it's actually implemented.
2018-06-07 19:54:51 +01:00
Dylan K. Taylor
428ca29e4b
Remove dead bedrockDepth fields from generator
...
yes, this is not implemented yet. fields for this can be added when proper bedrock generation is implemented. For now, it's just dead code.
2018-06-07 19:52:56 +01:00
Dylan K. Taylor
f61ad20f6b
Remove a whole bunch of dead copy-pasted code from Nether generator
2018-06-07 19:51:27 +01:00
Dylan K. Taylor
3c9af5cd6d
Generator: small reduction of code duplication
2018-06-07 19:49:51 +01:00
Dylan K. Taylor
996935e9b2
Cleaned up level seed handling
2018-06-07 19:39:24 +01:00
Dylan K. Taylor
3707a41b67
Server: small cleanup to seed handling
2018-06-07 18:25:44 +01:00
Dylan K. Taylor
354b2dc5d1
and an extra note just in case
2018-06-07 15:20:51 +01:00
Dylan K. Taylor
0c70b83d81
LevelProvider: workaround bug fixed in b54197904d6c23c5babe2857d0107d9d0fc8bd68 for previously-affected worlds
2018-06-07 15:18:42 +01:00
Dylan K. Taylor
083a1e1ff6
GeneratorManager: Make addGenerator() throw exceptions instead of returning false
2018-06-07 14:34:26 +01:00
Dylan K. Taylor
17b58357fb
GeneratorManager: add documentation for functions
2018-06-07 14:30:19 +01:00
Dylan K. Taylor
96a4dbb7d8
GeneratorManager: add typehints
2018-06-07 14:24:01 +01:00
Dylan K. Taylor
5eec683110
Generator: Moved generator registering things to a separate GeneratorManager class
...
this isolates the concerns of the Generator class, and also removes cyclic dependencies between the Generator class and its descendents.
2018-06-07 13:48:01 +01:00
Dylan K. Taylor
0bca3cd481
Generator: Move static noise functions to Noise instance methods
2018-06-07 13:40:10 +01:00
Dylan K. Taylor
b54197904d
Fixed imported worlds getting PM classpaths written into their level.dat for generator
...
This will not fix existing worlds affected by this bug.
2018-06-07 13:20:50 +01:00
Dylan K. Taylor
fb484087a8
Entity: Remove unnecessary scheduleUpdate() call from initEntity()
...
this is already done by the constructor
2018-06-07 12:53:59 +01:00
Dylan K. Taylor
14914781fc
Added exception throws when a closed tile or entity attempts to schedule itself for updating
...
I can't believe it took so long to find what was causing these stdClass bugs.
2018-06-07 12:37:26 +01:00
Dylan K. Taylor
fdd5b7b9c9
Entity: Fixed despawn flagging not kicking in until scheduling updates on entities
2018-06-07 12:34:23 +01:00
Dylan K. Taylor
c83c0eb935
Entity: Move responsibility of checking for despawn to Level
...
this ensures that flagging for despawn will always work as intended, including when onUpdate() is overridden.
2018-06-07 12:31:21 +01:00
Dylan K. Taylor
b331f8e1c9
AsyncWorker: added removeFromThreadStore()
...
and use it instead of overwriting with null things, which still occupies memory
2018-06-07 10:12:50 +01:00
Dylan K. Taylor
ee787974f2
AsyncWorker: Use statics for thread-local worker storage instead of globals
2018-06-07 09:59:32 +01:00
Dylan K. Taylor
73e56c8a36
Utils: Make kill() use static MainLogger instead of global variable
2018-06-07 09:29:53 +01:00
Dylan K. Taylor
5f7c884255
Reduce AsyncWorker default memory limit to 256MB
...
a worker shouldn't be using as much memory as the main server thread would, so 1024MB is extremely excessive.
2018-06-06 18:49:48 +01:00