Commit Graph

274 Commits

Author SHA1 Message Date
Dylan K. Taylor
dbf9a33160 ChunkSelector: Improve algorithm to send chunks in proper circles, instead of squares
this ensures that the edge of loaded terain is always the same distance
away in any direction. This also means that when flying parallel to X or
Z axes, you now have about 12% more chunks directly in front of you,
instead of to your left and right, which gives the impression that
chunks are loading faster (they aren't, they are just being ordered in a
more sensible way).
2021-11-06 00:15:04 +00:00
Dylan K. Taylor
0989c77037 Player: check that horizontal distance travelled is > 0 before adding exhaustion, or triggering a new chunk order
closes #4548
2021-11-05 15:46:55 +00:00
Dylan K. Taylor
5107d0df4e Player: cap maximum number of active generation requests
this fixes the horrible spotty chunk loading seen in https://twitter.com/dktapps/status/1456397007946461190?s=20.
In practice, this made chunks invisible on teleport for several tens of seconds after teleporting. Having a larger chunks-per-tick with large render distance compounded to worsen the problem.
It wasn't really noticeable on small render distances, but very obvious on large ones with fast chunk sending and slow generation.

This also fixes #4187 (at least to the extent that it works on PM3, anyway).
2021-11-05 15:09:42 +00:00
Dylan K. Taylor
2405e45b35 Player: mark as not using item when held item slot is changed
closes #4538
2021-11-03 21:26:20 +00:00
Dylan K. Taylor
ef82a2cd79 Fixed PlayerEmoteEvent::setEmoteId() being useless 2021-11-02 23:10:26 +00:00
Dylan K. Taylor
87031627bf Do not call PlayerEmoteEvent if rate limit was reached 2021-11-02 23:09:43 +00:00
Hashim
f066199971 Implement emote support (#4523) 2021-11-02 23:04:55 +00:00
Dylan K. Taylor
e34364412b Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
Rush2929
ede4157814 Check to see if the player can start using the Releasable item. (#4532) 2021-11-02 14:36:16 +00:00
Dylan K. Taylor
804fb3f603 Merge commit 141fbde660 2021-11-01 17:39:40 +00:00
Dylan K. Taylor
46b7d35cd3 Player: return from callback if used chunk status is not REQUESTED_GENERATION()
this can happen especially on large render distances when flying fast and changing direction - we decide we don't want the chunk, then, after changing direction and re-ordering chunks, we decide we do want it again, and end up registering a second callback. In this case, we need to ensure that only one of the callbacks gets executed (it doesn't matter which one).
2021-11-01 01:45:49 +00:00
Dylan K. Taylor
bd60e41268 Revert "Revert "Player: do not re-request the same ungenerated chunks multiple times""
This reverts commit 3265d3f6b4.
2021-10-31 22:57:56 +00:00
Dylan K. Taylor
3265d3f6b4 Revert "Player: do not re-request the same ungenerated chunks multiple times"
This reverts commit 866020dfdb.

For some fucking reason this broke resending chunks in some cases (and
sending chunks at all in others). I don't have time to debug this right
now, so it's going to have to remain broken, infuriatingly enough.
2021-10-31 21:25:21 +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
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
8a2ecfe1d4 Merge branch 'stable' 2021-10-29 19:04:01 +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
04aedc6494 Updated BedrockProtocol 2021-10-23 23:54:49 +01:00
Dylan K. Taylor
c773e43eda Updated BedrockProtocol to pmmp/BedrockProtocol@97fa88e9ef 2021-10-23 01:16:45 +01:00
Dylan K. Taylor
bb6ea8cbdc Do not call PlayerLoginEvent during the Player constructor
this closes a lot of loopholes in the login sequence that plugins were using to cause crashes.
2021-10-04 22:36:50 +01:00
Dylan K. Taylor
3836a57ba6 Player: add getPlayerInfo(), closes #4450 2021-09-17 22:17:36 +01:00
Dylan K. Taylor
5ddd94b7e8 Remove redundant World->isChunkGenerated() calls
isChunkGenerated() merely checks if the chunk can be loaded from disk, if it's not in the runtime cache already.
This is pointless in all of these cases, because the check is prefaced by an isChunkLoaded() check, which already limits the possibility anyway. If the chunk is not generated, it'll also be considered not loaded.
2021-09-12 15:21:09 +01:00
Dylan T
4111d92b98 Stop hardcoding chunk dimensions everywhere (#4443) 2021-09-10 16:13:25 +01:00
Dylan K. Taylor
cf762d345d Player: Log debug messages when canInteract() prevents block interaction 2021-09-10 15:58:38 +01:00
Dylan K. Taylor
082f0f2d57 Player: Generate an InventoryTransaction (with event) for crafting grid/cursor evacuation
this fixes the crack in the armour that allows creative players to drop items even when all drops are being cancelled by plugins.

closes #3284
2021-09-09 17:11:59 +01:00
Dylan K. Taylor
34f01a3ce3 World: Track entities separately from chunks
this allows entities to exist outside of generated chunks, with one caveat: they won't be saved in such cases.
Obviously, for player entities, this doesn't matter.

fixes #3947
2021-09-09 01:17:41 +01:00
Dylan K. Taylor
d4d00a9b80 Living: added calculateFallDamage()
to clean up the way that fall damage is handled for flying players; also, onHitGround() isn't only doing fall damage things these days.
2021-09-05 14:36:58 +01:00
Dylan K. Taylor
d329bfb25d Entity: rename movX/movY/movZ to wantedX/wantedY/wantedZ
this makes the code much easier to understand.
2021-09-05 14:06:53 +01:00
Dylan K. Taylor
8be1f34736 Entity: Rename fall() to onHitGround(), and make it protected
this had no business being exposed to public API in the first place.
2021-09-05 13:36:40 +01:00
Dylan K. Taylor
6ecad153ea Entity: remove fallDistance parameter from fall() 2021-09-05 13:34:43 +01:00
marshall
6e68e99ec0 Added PlayerEntityInteractEvent (#4374) 2021-08-24 11:56:10 +01:00
SalmonDE
7fd712c1ff Refactor Block & Tile: getPos() to getPosition() (#4395)
this also changes the name of the class property 'pos' to 'position' as well as Block->getPosOffset() to Block->getPositionOffset()
2021-08-23 14:01:32 +01:00
Dylan K. Taylor
270ee5c085 Simplify registry method generation 2021-08-22 23:02:36 +01:00
alvin0319
34a7405820 Player: fixed player can fly after respawn (#4388) 2021-08-20 22:51:36 +01:00
Dylan K. Taylor
bf8b5905e4 Player: Play ItemBreakSounds when items break due to usage
closes #4381
2021-08-19 15:56:40 +01:00
Dylan K. Taylor
b4b3c21d30 Merge branch 'stable' 2021-08-19 15:39:16 +01:00
Dylan K. Taylor
5da90b9530 Stop auto-translating strings when not asked
fixes #4371
2021-08-15 20:44:27 +01:00
Dylan K. Taylor
a81680c5c6 missed a few more hardcoded translation keys 2021-08-15 20:12:55 +01:00
Dylan K. Taylor
60ac76a3bc Remove more usages of hardcoded translation keys 2021-08-15 19:22:40 +01:00
Dylan K. Taylor
789a669395 Rename TranslationContainer -> Translatable 2021-08-15 16:17:46 +01:00
Dylan K. Taylor
8b9d7d6390 Support for nested TranslationContainers 2021-08-14 20:57:13 +01:00
Dylan K. Taylor
804d02b086 TranslationContainer: added prefix(), postfix() and format() 2021-08-14 16:08:22 +01:00
Dylan K. Taylor
13d4131d0d Remove player update warnings
a player ingame is not going to have access to the terminal to update PM, and if they do, they can see the warning on the console themselves anyway.
2021-08-14 13:27:21 +01:00
Dylan K. Taylor
b4c0ddd155 Use native union types for TranslationContainer|string 2021-08-10 15:17:26 +01:00
Dylan K. Taylor
2293bd948d Added KnownTranslationFactory and use it in as many places as possible
this makes translation usage much more statically analysable.
The only places this isn't used are:
- places that prefix translations with colours (those are still a problem)
- places where server/client translations don't match (e.g. gameMode.changed accepts different parameters in vanilla than in PM)
2021-08-10 14:50:40 +01:00
Dylan K. Taylor
b31dce2119 Player: fixed type of loadQueue field 2021-08-04 21:17:44 +01:00
Dylan K. Taylor
c567ed4b7a fix build error 2021-08-03 15:32:21 +01:00
Dylan K. Taylor
dcd203370b Player: make use of typed properties
readability significantly benefits from use of typed properties here.
2021-08-03 15:02:32 +01:00
Dylan K. Taylor
58498c2b0b Merge remote-tracking branch 'origin/stable' 2021-07-23 16:40:19 +01:00