14395 Commits

Author SHA1 Message Date
Dylan K. Taylor
f1a791ef75
Improved Promise API - separate resolver and consumer APIs
this makes creating a promise slightly more cumbersome, but I'm more concerned about people who might try to call 'new Promise' directly.
2021-10-31 19:49:57 +00:00
Dylan K. Taylor
866020dfdb
Player: do not re-request the same ungenerated chunks multiple times
this doesn't affect chunk resends, since they'll be kicked back to NEEDED, which is detected by orderChunks().
2021-10-31 18:52:37 +00:00
Dylan K. Taylor
c580bb2434
InGamePacketHandler: mark player as not using item in more cases
fixes #4355
2021-10-31 14:41:31 +00:00
Dylan K. Taylor
4fe3f69702
World: eliminate final remaining 'no loaders attached' debug message on player creation 2021-10-31 14:33:27 +00:00
Dylan K. Taylor
018006541e
changelog: mention block-picking changes
[ci skip]
2021-10-31 14:12:12 +00:00
Dylan K. Taylor
fbb91d123d
World::unregisterChunkListenerFromAll(): go through unregisterChunkListener()
this ensures that everything gets cleaned up properly (e.g. player chunk listeners).
2021-10-31 14:03:40 +00:00
Dylan K. Taylor
3dc75644d9
World: avoid duplicated logger code in initChunk() 2021-10-31 14:02:25 +00:00
Dylan K. Taylor
1cabe4baf3
World: do not crash on duplicate tiles loaded from disk
closes #4049
2021-10-31 13:58:32 +00:00
Dylan K. Taylor
73dc0598e4
CrashDump: remove derp space 2021-10-30 23:22:37 +01:00
Dylan K. Taylor
faad2365e2
World: Register a temporary chunk loader on chunks used by PopulationTask
fixes #3839
2021-10-30 22:17:06 +01:00
Dylan K. Taylor
4f816d03a7
SurvivalBlockBreakHandler: remove useless code 2021-10-30 21:35:58 +01:00
Dylan K. Taylor
1d22761d27
Remove useless newline 2021-10-30 21:25:47 +01:00
Dylan K. Taylor
5b8ce7e3e2
Cake: fixed desync on cancellation of eating
closes #3591
we don't support eating in creative right now, but the cake shouldn't appear to be eaten when it's not.
2021-10-30 21:02:24 +01:00
Dylan K. Taylor
08f3c18de9
Arrow: do not add pickups to creative players' inventories
closes #2932
2021-10-30 17:16:46 +01:00
Dylan K. Taylor
141fbde660
Player: fixed getting re-banned on rejoin after unban from hardcore death
closes #2175
2021-10-30 16:58:03 +01:00
Dylan K. Taylor
465a509858
World: remove spammy debug message 2021-10-30 16:13:01 +01:00
Dylan K. Taylor
69952ae2af
Human: limit lifetime total XP range to INT32_MAX
closes #4484
2021-10-30 16:05:10 +01:00
Dylan K. Taylor
71f2a34616
Entity: spawnTo() must silently swallow errors
Player->showPlayer() assumes that spawnTo() will take care of all the checks necessary to ensure we don't actually spawn a player to someone it shouldn't be able to see. In PM3, there's nothing we can do about that.
This could be a problem if anything decides to override spawnTo() to do additional stuff and assumes that the function will always succeed; however, there's not much reason to do that (plugins sending packets should override sendSpawnPacket() instead).
2021-10-30 15:38:27 +01:00
Dylan K. Taylor
63dfcc60c3
4.0.0-BETA9 is next 2021-10-29 22:35:23 +01:00
Dylan K. Taylor
428bd5ae91
Release 4.0.0-BETA8 4.0.0-BETA8 2021-10-29 22:35:15 +01:00
Dylan K. Taylor
d17cd65803
3.25.2 is next 2021-10-29 22:23:28 +01:00
Dylan K. Taylor
a8d5e8c5f6
Release 3.25.1 3.25.1 2021-10-29 22:23:22 +01:00
Dylan K. Taylor
19f448d074
pocketmine/math 0.4.0 2021-10-29 21:56:56 +01:00
Dylan K. Taylor
1c18c731ef
bootstrap: check for zlib raw support in leveldb 2021-10-29 19:15:12 +01:00
Dylan K. Taylor
8a2ecfe1d4
Merge branch 'stable' 2021-10-29 19:04:01 +01:00
Dylan K. Taylor
089e62b44e
Entity::spawnTo(): verify that the target player belongs to the same world as the entity
this should never be hit in the PM case, but it's an InvalidArgument rather than AssumptionFailedError because plugins can and do call this with bad things.
2021-10-29 18:54:00 +01:00
Dylan K. Taylor
32a34d2494
Location: change order of constructor parameters
to be consistent with Position::__construct() and Location::fromObject() (although Location::fromObject() has no choice, thanks to the anti-feature known as late static binding ...)
2021-10-29 15:43:09 +01:00
Dylan K. Taylor
ee9f5e0044
Location: make __construct() parameters mandatory
I did consider allowing yaw/pitch to remain optional, but considering the implicit immutability of Location, it really doesn't make any sense to create a Location with default yaw/pitch - just create a Position in that case instead.
2021-10-29 15:40:58 +01:00
Dylan K. Taylor
88b7389080
InventoryManager: reduce code duplication 2021-10-29 15:37:52 +01:00
Dylan K. Taylor
f1cc168d26
phpstan: exclude a couple of files from analysis temporarily
close #4472
2021-10-29 00:23:13 +01:00
Dylan K. Taylor
fb5543a2ad
Updated BedrockProtocol dependency 2021-10-29 00:16:11 +01:00
Dylan K. Taylor
a4eda9a8f5
World: call nearby entities' onNearbyBlockChange() in setChunk()
fixes #2779 in all known cases.
2021-10-28 23:59:32 +01:00
Dylan K. Taylor
eb75df6f8e
World: Intelligently perform automatic transfer or deletion of tiles in setChunk(), depending on the context
tiles may be deleted in the following circumstances:
1) the target block in the new chunk doesn't expect a tile
2) the target block in the new chunk expects a different type of tile (responsibility of the plugin developer to create the new tile)
3) there's already a tile in the target chunk which conflicts with the old one

In all other cases, the tile will be transferred.

This resolves a large number of unintentional bugs caused by world editors replacing chunks without setting the deleteTilesAndEntities parameter to false (even the core itself does it).

closes #4520
2021-10-28 23:48:17 +01:00
Dylan K. Taylor
c66790b6a6
World: never delete entities in setChunk()
entities exist completely independently from chunks now, so there is no need to interact with them whatsoever.
As I wrote in #4520, there's no sense in deleting entities here, since a chunk replacement is essentially just a mass block update.

On that theme, it might be a good idea to call Entity->onNearbyBlockChange() for all entities in the target and adjacent chunks when replacing a chunk, to ensure that they get the proper movement updates.
2021-10-28 23:42:28 +01:00
Dylan K. Taylor
d78801b9d5
World: fixed tiles and entities getting deleted when adjacent chunks are modified during population 2021-10-28 22:24:47 +01:00
Dylan K. Taylor
d410db4302
Chunk: rename DIRTY_FLAG_TERRAIN to DIRTY_FLAG_BLOCKS
we use the word 'terrain' elsewhere to refer to the combination of blocks and biomes, so using TERRAIN here is misleading.
2021-10-28 22:11:07 +01:00
Dylan K. Taylor
a62ce64fdd
Revert "Chunk: added modification counter"
This reverts commit a5418a019dc2a83210084632130db8ce06f529ea.

The more I assessed this, the more I realized that this implementation
doesn't actually offer any value. Since modcounters don't persist after
chunk unload + reload, they can't be reliably used to detect changes in
chunks without additional event subscriptions.
For the purpose I actually intended to use them for (population task
cancellation) there's a) another solution, and b) modcounts are
unreliable for that too, because of the aforementioned potential for
chunks to get unloaded and reloaded.
For the case of detecting dirty chunks within PopulationTask itself,
they are also unnecessary, since the dirty flags are sufficient within
there, since FastChunkSerializer doesn't copy dirty flags.

In conclusion, this was a misbegotten addition with little real value,
but does impact performance in hot paths.
2021-10-28 21:02:04 +01:00
Dylan K. Taylor
5db3915aad
Make MemoryManager aware of ChunkCache 2021-10-28 20:28:00 +01:00
Dylan K. Taylor
eb40b741ae
StandardPacketBroadcaster now splits broadcasts by session-specific PacketSerializerContext
in the normal case, all sessions will share the same PacketSerializerContext and Compressor, so this code will be the same as before
However, for the multi-protocol hackers out there, this should reduce the maintenance burden (@Driesboy) since now only the PacketSerializerContext needs to be maintained. I recommend a separate PacketSerializerContext for each protocol (perhaps put the protocol version in the serializer context too, if you need it for some reason).
2021-10-28 20:15:37 +01:00
Dylan K. Taylor
b3720b3f17
4.0.0-BETA8 is next 2021-10-28 17:28:53 +01:00
Dylan K. Taylor
7effa03ba4
Release 4.0.0-BETA7 4.0.0-BETA7 2021-10-28 17:28:48 +01:00
Dylan K. Taylor
d0474ccd92
make-release: note which channel the build will be released into 2021-10-28 16:29:20 +01:00
Dylan K. Taylor
2b0768f720
make-release: fixed retention of +dev on release versions 2021-10-28 16:26:56 +01:00
Dylan K. Taylor
dba148cfaa
build/make-release: make arg parsing use getopt 2021-10-28 16:25:18 +01:00
Dylan K. Taylor
48f77abe7e
Leave channel ID in VersionInfo
so that I don't have to type it out every time I make a new release. Most of the time it's going to be posted to the same channel as before anyway.
2021-10-28 16:03:43 +01:00
Dylan K. Taylor
bb05af103d
PluginManager: fixed crash when using a plugin-loader plugin (read: devtools)
closes #4518
2021-10-28 15:55:05 +01:00
Dylan K. Taylor
0ef5c67b9b
Use static constructor for MovePlayerPacket
this marks the last of the packets created using the old way.
2021-10-27 21:10:16 +01:00
Dylan K. Taylor
6d89265510
Player: reduce code duplication
back when this was just hardcoded >> 4 everywhere, nobody thought anything of it, but now it uses constants, it's easy to cross-reference and see where the duplicates are.
2021-10-26 23:02:50 +01:00
Dylan K. Taylor
a7d8a598e1
World: reduce code duplication for chunk coordinate calculation 2021-10-26 22:58:17 +01:00
Dylan K. Taylor
51fbff204b
World: make PhpStorm understand return type of getAdjacentChunks() 2021-10-26 20:32:09 +01:00