279 Commits

Author SHA1 Message Date
Dylan K. Taylor
5096741b29 World::getChunk() behaviour now matches that of a regular ChunkManager
Various bugs existed for a while with stuff using chunk managers instead of worlds when interacting with terrain due to a behavioural inconsistency between World::getChunk() (return from cache or load from disk), and SimpleChunkManager::getChunk() (return from cache only). This change brings the two in line.
World::getOrLoadChunk() has been added as a replacement, which has the same behaviour as the old getChunk() and also makes it more obvious that there is an issue with code using it during refactoring.
2020-09-20 13:29:09 +01:00
Dylan K. Taylor
0aee39027e Merge branch 'stable' into master
# Conflicts:
#	composer.lock
#	resources/vanilla
#	src/entity/Living.php
#	src/pocketmine/Player.php
#	src/pocketmine/VersionInfo.php
#	src/pocketmine/block/Potato.php
#	src/pocketmine/block/Sugarcane.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/Chunk.php
#	src/pocketmine/level/format/io/leveldb/LevelDB.php
#	src/world/generator/GeneratorRegisterTask.php
#	tests/phpstan/configs/check-explicit-mixed-baseline.neon
#	tests/phpstan/configs/l7-baseline.neon
#	tests/phpstan/configs/l8-baseline.neon
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMainLoggerTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskMemoryLeakTest.php
#	tests/plugins/TesterPlugin/src/pmmp/TesterPlugin/tests/AsyncTaskPublishProgressRaceTest.php
2020-09-04 01:43:52 +01:00
Dylan K. Taylor
ebd20f997d Merge commit 'e80ad22702f87f4a006ab16af3b46baae0490856' into master
# Conflicts:
#	build/php
#	resources/vanilla
#	src/pocketmine/Player.php
#	tests/plugins/DevTools
2020-08-21 21:39:17 +01:00
Jack Honour
ff2a3baa8e
Implemented Jukebox & Records (#3742)
Co-authored-by: Dylan K. Taylor <odigiman@gmail.com>
2020-08-07 21:07:58 +01:00
Dylan K. Taylor
b725fcbdf2 IPlayer: remove circular dependency on Player
and remove useless Player->getPlayer()
2020-08-05 22:01:41 +01:00
Dylan K. Taylor
060c300d50 Bed::setOccupied() no longer sets itself into the world
setting itself into the world is very annoying when trying to simply set up a blockstate.
2020-08-05 20:59:59 +01:00
Dylan K. Taylor
ed144a1709 remove unused imports 2020-07-21 19:29:12 +01:00
Dylan K. Taylor
217f9c574a Player no longer implements ChunkLoader
this stops plugins from misusing Player as a ChunkLoader in ways it doesn't know about, causing leaks and god knows what else.
2020-07-11 18:48:10 +01:00
Dylan K. Taylor
279abb871d Remove all usages of CompoundTag->hasTag()
in pretty much every case, these usages really wanted to read the tag's contents anyway, which can be combined with a getTag() and instanceof call for more concise and static analysis friendly code.
In the few cases where the tag contents wasn't needed, it still wanted to check the type, which, again, can be done in a more static analysis friendly way by just using getTag() and instanceof.
2020-07-10 21:01:43 +01:00
Dylan K. Taylor
b22cc4875e Player: Accept NBT data in constructor, instead of asking for it from the server directly
this allows custom implementations to provide custom data to the constructor (or none at all).
2020-07-09 13:09:46 +01:00
Dylan K. Taylor
9e1d9768f0 Merge branch 'stable'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-07-09 12:37:50 +01:00
Dylan K. Taylor
874fec0a35 Switch back to PM3 spawn-chunk handling, fix pre-spawn death bug caused by 939dfd9269df0feaff5b96d0dd628055b9706b95, close #3513 (properly this time) 2020-07-09 12:35:45 +01:00
Dylan K. Taylor
36727aabf7 Extracted a ChunkSelector unit from Player
if anyone asks me why not use a static method, it's because I want to make this more dynamic going forward, and statics are anything but.
2020-07-09 11:42:12 +01:00
Govdim
7f81507ea1
Add Releasable interface (#3664)
closes #3301
2020-06-30 21:09:10 +01:00
Dylan K. Taylor
8b87cf73b9 Player->setSpawn() now accepts NULL (fallback to world spawn) 2020-06-29 22:51:02 +01:00
Dylan K. Taylor
fc60abe5e5 Player: fixed a few phpstan level 8 warnings 2020-06-29 22:41:17 +01:00
Dylan K. Taylor
69fb2786c6 Player: fixed spawn position sticking to old world spawn when new world spawn is set
this will still take effect for preexisting data because the server will still see previously set spawns as custom, but for new players, their spawns will follow the world spawn unless they sleep in a bed.
2020-06-29 22:32:00 +01:00
Dylan K. Taylor
670ad9eb9d Position: rename getWorldNonNull() to getWorld(), remove original getWorld() 2020-06-29 21:19:46 +01:00
Dylan K. Taylor
fc22fd80d8 Eradicate remaining usages of Position->getWorld() 2020-06-29 21:03:55 +01:00
Dylan T
d585081c22
Separate consumable item interfaces from general consumable interfaces (#3595)
I wonder if there's a way to generalise item consuming beyond just eating/drinking. Stuff like lava bucket in a furnace needs the same kind of "leftover" logic.
2020-06-28 17:53:03 +01:00
Dylan K. Taylor
2104b2d32b Entity: defer kill() until post-construct
this fixes crashes and various bugs with death logic executing during the creation of entities, as well as an age-old Player crash after quitting the server when dying.
2020-06-27 23:28:03 +01:00
Dylan K. Taylor
87ce92d87e Entity: some cleanup of network position hacks 2020-06-27 23:16:04 +01:00
Dylan K. Taylor
ff00595a48 Remove some more Vector3 mutations 2020-06-27 20:58:02 +01:00
Dylan K. Taylor
52fd1a8c1d CommandSender: export getLanguage()
this currently serves as a proxy to the server main language, but it can be used by third party implementations to choose a non-Server language.
2020-06-22 20:05:23 +01:00
Dylan K. Taylor
47baaf4c72 move NBT helper functions from EntityFactory to EntityDataHelper 2020-06-19 22:04:36 +01:00
Dylan K. Taylor
4b528aa637 NBT is no longer needed to create an entity
it's still able to be provided, but shouldn't be needed in the majority of cases (constructor args and/or API methods should be sufficient).
2020-06-19 10:51:27 +01:00
Dylan K. Taylor
0a1bb0041b Player: avoid using NBT for onGround hack 2020-06-19 10:51:27 +01:00
Dylan K. Taylor
1205432c34 Extract mandatory parameters into constructor parameters
the goal is obviously to ditch NBT entirely here, but there's more work to be done before that becomes possible.
2020-06-19 10:51:27 +01:00
Dylan K. Taylor
0a3bd6fe78 Merge commit 'a0de9b0d4'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-04 14:11:00 +01:00
Dylan K. Taylor
fcc2352203 Merge commit '03e8cd3ed'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
2020-06-04 14:07:55 +01:00
Dylan K. Taylor
899da1b7f7 Merge commit '42e14f749'
# Conflicts:
#	resources/vanilla
#	src/pocketmine/Player.php
#	src/pocketmine/item/Bow.php
#	src/world/World.php
2020-06-03 12:31:17 +01:00
Dylan K. Taylor
bbf3f4c476 Merge branch 'next-minor' 2020-05-31 18:40:19 +01:00
Dylan K. Taylor
81d11ea4e3 Player: make selectChunks() non-dependent on the player's current view distance & location 2020-05-24 18:59:43 +01:00
Dylan K. Taylor
fe649d8d70 Extract ServerConfigGroup from Server
this API isn't very nice, but it's pretty much the same as the original, and at least this can be _kinda_ unit-tested...
2020-05-24 15:48:03 +01:00
Dylan K. Taylor
6257f717b1 Entity: make networkProperties private
this reduces the temptation to use it in high-level code, as well as making syncNetworkData() more useful (now it can export to many data collections, which means we can start to think about having a property cache per network session, which is more flexible)
2020-05-21 20:29:06 +01:00
Dylan K. Taylor
ac4c1c9086 Clean up to SurvivalBlockBreakHandler internals - don't create a handler if it won't be used anyway 2020-05-12 22:45:42 +01:00
Dylan K. Taylor
3a6cdba281 Implemented server-side block-break FX handling, closes #3485
this had been planned for a long time already, just never finished.
It's not fully done, because there needs to be synchronization of block-break handlers between different players attempting to break the same block, but this should resolve a lot of the bugs that previously existed, while also opening the doors to making the logic more flexible.
2020-05-11 21:16:30 +01:00
Dylan K. Taylor
b7cf4f01f9 remove utils\UUID, switch to pocketmine/uuid package 2020-05-11 10:46:48 +01:00
Dylan K. Taylor
9cf410d484 Player: fixed broken behaviour of entity spawning on chunk send, closes #3355 2020-05-05 18:55:13 +01:00
Dylan K. Taylor
d3dcb8a4e3 moving entity attack sounds to server-side 2020-05-04 11:50:42 +01:00
Dylan K. Taylor
b1021315b0 World: remove protocol-specialized broadcastLevelEvent() 2020-05-04 02:28:34 +01:00
Dylan K. Taylor
8682ea35f7 Introduce some (not great) API for entity animations
while this API is a bit yucky, it's a step forward for protocol isolation and offers the possibility of controlling animations by adding events.
2020-05-01 13:57:26 +01:00
Dylan K. Taylor
9615186afd rename PunchBlockParticle -> BlockPunchParticle 2020-05-01 12:36:31 +01:00
Dylan K. Taylor
2964a4be35 making BlockPunchSound server-controlled 2020-05-01 12:23:00 +01:00
Dylan K. Taylor
d1b28ce17a NetworkSession: allow sending an arbitrary set of attributes for an entity 2020-04-29 16:45:09 +01:00
Dylan K. Taylor
f6f714c158 NetworkSession: do not mark shared attributes as synchronized, they don't necessarily belong to us
if we decided to start sending entity attribute changes to viewers too, this would have caused some unexpected behaviour.
2020-04-29 16:38:10 +01:00
Muqsit
5a33dbd4c6 Player: drop isAdmin from kick(), closes #3275 2020-04-19 18:27:37 +01:00
Dylan K. Taylor
163c3855eb Merge branch 'next-minor'
# Conflicts:
#	resources/vanilla
#	src/plugin/PluginBase.php
#	src/plugin/PluginDescription.php
#	src/pocketmine/Player.php
#	src/pocketmine/network/rcon/RCON.php
#	src/pocketmine/network/rcon/RCONInstance.php
#	src/pocketmine/scheduler/AsyncTask.php
#	src/pocketmine/tile/Spawnable.php
#	src/scheduler/AsyncPool.php
#	src/utils/Config.php
#	src/utils/Timezone.php
#	src/utils/UUID.php
#	src/utils/Utils.php
#	src/world/format/io/region/RegionLoader.php
2020-04-19 11:13:41 +01:00
Dylan K. Taylor
86e051b7bf Merge commit 'a2543ff80d2906bccda1a4e2fdbd9d8e7d147fb3' 2020-04-18 17:33:05 +01:00
Dylan K. Taylor
a95426c373 Merge branch 'stable' 2020-03-18 13:17:38 +00:00