Commit Graph

11789 Commits

Author SHA1 Message Date
Dylan K. Taylor
42e915b902 Player: added locking variable to prevent reentry into respawn() while awaiting spawn terrain generation 2021-05-12 12:10:32 +01:00
Dylan K. Taylor
4a68e0219e shut 2021-05-11 19:29:30 +01:00
Dylan K. Taylor
ab0500ae4f Player: Fixed a multitude of bugs with respawning
the following things are changed:
- Player->getSpawn() no longer returns a safe spawn by default. Instead, if the player doesn't have a spawn set, it returns the world's stored spawn directly. This allows consistent behaviour of locating safe respawn positions without double calculation of safe spawn position, and also fixes crash issues during the login sequence if the player's spawn position referred to ungenerated terrain.
- Player->respawn() is now asynchronous, using the promise returned by orderChunkPopulation() to complete respawn after the terrain is generated. This allows consistently selecting a safe respawn position and fixes crashes when respawning if the spawn location was in ungenerated terrain.

There remains a problem that ragequit respawns are still only handled right after PlayerJoinEvent, which leads to the original spawn terrain being sent to the player, which is obviously very wasteful. However, that's a problem for a later commit.
2021-05-11 19:15:31 +01:00
Dylan K. Taylor
094c949e86 Entity: fixed extremely stupid bug with player respawning after ragequit 2021-05-11 19:08:56 +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
f909557529 Cleaned up implementations for EnderChestInventory/DoubleChestInventory
previously, these were forced to extend BaseInventory because of the amount of crap in Inventory's interface.
This meant that these inventories had their own slots storage, which would be _mostly_ unused because these inventories aren't real inventories, but rather just delegates.
This lead to a variety of bugs in the past, such as certain API methods on BaseInventory not working correctly for DoubleChestInventory in particular.

Now, BaseInventory just implements the functional part of the inventory implementation, leaving the storage system up to the implementation.
A SimpleInventory class is provided with a simple SplFixedArray storage backing, which is used by most inventories.
EnderChestInventory and DoubleChestInventory now extend BaseInventory directly, and implement custom methods for dealing with their delegates.
2021-05-09 20:51:16 +01:00
Dylan K. Taylor
1533789f35 Player: fixed not subscribing to own inventory updates
fixes #4211
2021-05-09 19:36:36 +01:00
Dylan K. Taylor
20197e6813 RakLibServer: clean up constructor parameters 2021-05-08 20:13:29 +01:00
Dylan K. Taylor
1003fde2fc RakLibServer: make all parameters mandatory 2021-05-08 20:11:16 +01:00
Dylan K. Taylor
2ce6a87d05 getSafeSpawn() may throw if the target terrain is not generated 2021-05-08 16:22:13 +01:00
Dylan K. Taylor
e9f3cefe94 Default world might be null 2021-05-08 16:21:34 +01:00
Dylan K. Taylor
027109075c WorldManager: don't recalculate the spawn point for every player teleported during world unload 2021-05-08 16:19:22 +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
f9bfc0df73 NetworkSession: don't crash on teleporting to other world during PlayerLoginEvent 2021-05-07 22:47:06 +01:00
Dylan K. Taylor
6cb285d4a9 Added constants for the handler tag types 2021-05-06 18:40:14 +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
c356abb917 BlockTransaction: remove cyclic reference to self in callbacks 2021-05-06 14:27:08 +01:00
Dylan K. Taylor
01794adef1 ... 2021-05-05 22:24:23 +01:00
Dylan K. Taylor
652de2632a Rough OffHand implementation
this doesn't do stuff like taking arrows from offhand yet.
2021-05-05 14:46:51 +01:00
Dylan K. Taylor
4ca5558ec1 Merge remote-tracking branch 'origin/stable' 2021-05-05 11:14:01 +01:00
Dylan K. Taylor
176ca3fd2f shut 2021-05-02 14:56:56 +01:00
Dylan K. Taylor
b8645f5c15 Clean up EnderChestInventory implementation
now, EnderChestInventory is just a temporary window, much like anvil/enchanting windows. It provides a gateway to the player's PlayerEnderInventory.

This removes one of the remaining obstacles to disallowing null World in Position constructor.
2021-05-02 14:26:27 +01:00
Dylan K. Taylor
4c783f1037 shut 2021-05-02 13:43:37 +01:00
Dylan K. Taylor
988c976459 Remove unused import 2021-05-02 13:40:18 +01:00
Dylan K. Taylor
9b8f32c584 Extract inventory helper methods from BaseInventory to a trait
this allows easier alternate implementations of Inventory that don't extend BaseInventory (e.g. double chest, or delegate inventory).
2021-05-02 13:38:49 +01:00
Dylan K. Taylor
c47ecb55c0 Sign: Do not allow edits by any player except the one who placed it, and only while that player is online
signs now become finalized if:
- the player quits and rejoins (because the entity runtime ID of the player will not be the same)
- the chunk is unloaded and reloaded (because the tagged entity runtime ID is not saved).

closes #4198
2021-05-02 13:22:31 +01:00
Dylan K. Taylor
f538440bce De-spaghettify the hierarchy for chest inventories 2021-04-30 13:44:39 +01:00
Dylan K. Taylor
d37016f43b Vine: added API to get/set faces 2021-04-30 13:35:38 +01:00
Dylan K. Taylor
726978b8f1 Migrate all coloured blocks (except glazed terracotta) to dynamic colours 2021-04-29 20:11:03 +01:00
Dylan K. Taylor
593a8ac529 Added Loom blocks
these don't support doing patterns yet, but their inventories work.
2021-04-29 19:51:09 +01:00
Dylan K. Taylor
4b5f279a3e UseItemOnEntityTransactionData: added missing type 2021-04-29 19:13:52 +01:00
Dylan K. Taylor
b33bf1f433 Unfuck banners ... 2021-04-28 18:44:21 +01:00
Dylan K. Taylor
d5e5a81cff Don't explode when data contains invalid dye colour IDs 2021-04-28 13:39:03 +01:00
Dylan K. Taylor
a44203a3d4 Separate BannerPatternLayer from BannerPatternType 2021-04-28 12:47:42 +01:00
Dylan K. Taylor
2bc0f9f7a2 TimingsCommand: do not enable timings if they are already enabled
this causes timings to be reset, which is potentially undesirable (loss of already-collected timing data).
closes #4194
2021-04-27 22:39:13 +01:00
Dylan K. Taylor
8a3df1212a Added a trait for blocks which face opposite their placing player 2021-04-27 21:28:26 +01:00
Dylan K. Taylor
72045b3d7e CoralBlock: added setCoralType() 2021-04-27 21:03:23 +01:00
Dylan K. Taylor
f204d6b3dd Make a trait for blocks which share the same horizontal facing metadata logic 2021-04-27 20:59:20 +01:00
Dylan K. Taylor
11263909ab Added stripped logs (incomplete)
this isn't practical to fully implement right now due to limitations
imposed by the legacy shitfest system we're using. To make stripped
dynamic, we would need to switch the IDs _and_ variant info dynamically,
and I have no idea what bizarre side effects that might have.
2021-04-27 20:35:58 +01:00
Dylan K. Taylor
ed80490234 Added more APIs to Skull
setRotation() is conditionally useless, but there's not much we can do about this right now; and exposing it like this is better than having plugins interacting with tiles.
2021-04-27 19:31:08 +01:00
Dylan K. Taylor
c9cf33b21b Skull: added block property APIs
I need these for my R13 block deserializer.
2021-04-27 19:22:45 +01:00
Dylan K. Taylor
0aa0d77307 Skull: recognize noDrops flag 2021-04-27 19:21:29 +01:00
Dylan K. Taylor
017ca55a58 Vine: use facing as both keys and values 2021-04-27 15:19:55 +01:00
Dylan K. Taylor
845819123d Player: drop perm nulling
this is no longer necessary because the PermissibleBase doesn't keep a ref to the Player anymore.
2021-04-27 14:49:26 +01:00
Dylan K. Taylor
8364bc51ac ... 2021-04-27 14:47:11 +01:00
Dylan K. Taylor
7ce77713dd InventoryManager: add a mechanism to allow plugins to inject their own container open packet creators
closes #4008
2021-04-27 14:40:43 +01:00
Dylan K. Taylor
89260d788c 3.19.2 is next 2021-04-25 20:34:13 +01:00
Dylan K. Taylor
a7cd081002 Release 3.19.1 2021-04-25 20:34:13 +01:00