290 Commits

Author SHA1 Message Date
Dylan K. Taylor
1ecb10acba
Merge branch 'next-minor' into next-major 2022-08-21 19:19:07 +01:00
Dylan K. Taylor
ad2d59923c
Merge branch 'stable' into next-minor 2022-08-18 17:06:15 +01:00
Dylan K. Taylor
792c1b62b7
Introduce and use TransactionBuilder for inventory evacuations 2022-08-18 17:04:12 +01:00
NoClip
2f4a9469b6
Player: spectator shouldn't able to pick blocks they don't have (#5111)
Jury is out on whether they should be able to pick blocks at all, or be considered to have infinite resources, but this solution has been used in a few other places already anyway, so it can be cleaned up another time.
2022-08-15 16:48:37 +01:00
Dylan K. Taylor
c8a8e33fc1
Merge branch 'next-minor' into next-major 2022-07-24 21:24:08 +01:00
Dylan K. Taylor
608c6ed6db
Improved suboptimal code in Player::handleMovement() 2022-07-24 20:51:28 +01:00
Dylan K. Taylor
b3f8b5ff37
Fix CS 2022-07-16 20:01:29 +01:00
Dylan K. Taylor
d0ff6d2e36
Enable various types of interaction to return items to the player, without needing to have a bunch of boilerplate creative mode and held item checks
it became glaringly obvious that this was needed because of #4827 and #4868.

this is further needed with the addition of cauldrons.
2022-07-16 19:50:33 +01:00
Dylan K. Taylor
dea0207e4e
Merge branch 'next-minor' into next-major 2022-07-13 17:06:04 +01:00
Dylan K. Taylor
06655bee78
Updated to 1.19.10 2022-07-13 00:59:49 +01:00
Dylan K. Taylor
68cbe46600
Exterminate legacy item IDs 2022-07-05 15:12:55 +01:00
Dylan K. Taylor
d9544b5d0e
Added soul fire 2022-07-04 22:32:35 +01:00
Dylan K. Taylor
04b855235a
Merge branch 'next-major' into modern-world-support 2022-06-24 01:35:46 +01:00
Dylan K. Taylor
72d8b54188
Merge branch 'next-minor' into next-major 2022-06-24 01:33:15 +01:00
Dylan K. Taylor
bb5b52d998
Player: fix terrain getting redrawn when moving in noclip mode 2022-06-09 13:48:29 +01:00
Dylan K. Taylor
1ff69136a3
Merge branch 'next-major' into modern-world-support 2022-06-07 20:01:40 +01:00
Dylan K. Taylor
aa9f8781ff
Merge branch 'next-minor' into next-major 2022-06-07 19:56:26 +01:00
Dylan K. Taylor
d2613039ed
Replace BlockLegacyIds usages with BlockTypeIds where possible 2022-06-05 21:17:10 +01:00
Dylan K. Taylor
083a35f970
Modernize property type declarations 2022-06-04 18:16:32 +01:00
Dylan K. Taylor
38d6284671
Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
Dylan K. Taylor
7b8eeb42f6
Use typed properties in src/entity package
[bc break]
2022-06-01 21:19:02 +01:00
Dylan K. Taylor
812d5c3f58
Merge branch 'stable' into next-minor 2022-05-24 14:17:53 +01:00
Dylan K. Taylor
38d75f3aab
Player: Be more explicit about not parsing chat messages when messageCounter is zero
the length check technically accounts for this, but future readers might not realize this
2022-05-22 16:46:53 +01:00
Dylan K. Taylor
179cac45f5
Merge branch 'stable' into next-minor 2022-05-22 16:21:05 +01:00
Dylan K. Taylor
c82dfef9b0
Player: fix weird behaviour when teleporting sleeping players
closes #4672
2022-05-21 20:08:12 +01:00
Dylan K. Taylor
1181b13b5d
Player: call InventoryCloseEvent after doing the necessary business
closes #4626

this does change the behaviour of getCurrentWindow() during InventoryCloseEvent, but no one should be using that anyway, since InventoryCloseEvent->getInventory() exists.
2022-05-21 19:23:59 +01:00
TheNewHEROBRINEX
02cf6ae46c
Added PlayerDeathEvent->setKeepXp(), closes #4002 (#4015) 2022-05-21 16:41:14 +01:00
Dylan K. Taylor
86efa0aae6
Merge remote-tracking branch 'origin/stable' into next-minor 2022-05-20 17:49:04 +01:00
Dylan K. Taylor
554f96bc24
InventoryManager: Defer opening new windows to the client until the window close handshake has been completed
fixes #5021 and probably a bunch of other inventory related glitches

When the server initiates a window close, it does so by sending a ContainerClose to the client, which causes the
client to behave as if it initiated the close itself. It responds by sending a ContainerClose back to the server,
which the server is then expected to respond to.

Sending the client a new window before sending this final response creates buggy behaviour on the client, which
is problematic when switching windows. Therefore, we defer sending any new windows until after the client
responds to our window close instruction, so that we can complete the window handshake correctly.

This is a pile of complicated garbage that only exists because Mojang overengineered the process of opening and
closing inventory windows.
2022-05-20 16:54:15 +01:00
Dylan K. Taylor
7bc3dcdefd
Modernize private property declarations in src/player 2022-05-17 21:36:51 +01:00
Duo Incure
89cc449808
Update exhaustion values for 1.18.30 (#5034) 2022-05-17 18:28:19 +01:00
Dylan T
8b8560a701
Added PlayerPostChunkSendEvent (#4937)
this is primarily useful for debugging plugins, but could also be useful for other things, such as spawning fake blocks, particles, etc.
2022-05-17 15:40:01 +01:00
Dylan K. Taylor
937bb4c6ce
Merge branch 'stable' into next-minor 2022-04-28 21:00:23 +01:00
ねらひかだ
27056b6c37
Player: creative players should not be damaged by the void (#4978) 2022-04-21 16:39:36 +01:00
Dylan K. Taylor
df33e179e5
Player: fixed chat newlines denial-of-service vulnerability
irresponsibly reported in #4974

closes #4974
2022-04-20 13:01:05 +01:00
Dylan K. Taylor
7d1464f0a1
Merge branch 'stable' into next-minor 2022-03-28 17:18:54 +01:00
Dylan K. Taylor
901449b0b1
Player: simplify PlayerItemHeldEvent calling on content change
the second parameter to this callback is the OLD slots, not the changed slots. This means that ALL slots are included, including empty and unchanged slots.
2022-03-23 13:47:01 +00:00
Dylan K. Taylor
a9f2766a8b
Merge branch 'stable' into next-minor 2022-03-23 13:39:41 +00:00
Dylan K. Taylor
ea33a04d00
Player: ensure that PlayerItemHeldEvent is called when the contents of the held slot changes
in PM3, this was done by implicitly relying on the client to send a MobEquipmentPacket selecting the same hotbar slot when the slot contents changes.
In PM4, we avoid relying on this, and fire the event directly when the listener detects a held slot change.
This ensures that the behaviour remains consistent regardless of what the client starts doing in the future.

closes #4905
2022-03-22 16:53:02 +00:00
Dylan K. Taylor
ab93135b84
Merge branch 'stable' into next-minor 2022-03-22 15:49:58 +00:00
Dylan K. Taylor
856fd2a33b
fix PHPStan failures 2022-03-09 17:26:05 +00:00
IvanCraft623
90a369f0b6
Humans can now do emotes (#4610)
added the following API methods:
- Human::emote()
2022-03-03 18:19:30 +00:00
ShockedPlot7560
b9f1bcf0e4
Implement PlayerViewDistanceChangeEvent (#4749)
closes #4550
2022-01-25 18:00:26 +00:00
Dylan K. Taylor
419bb9eba6
Player: fixed parameter name inconsistency 2022-01-22 01:33:31 +00:00
Dylan K. Taylor
373880e582
Replace disallowed operators in src/player/ 2022-01-20 19:16:00 +00:00
Dylan K. Taylor
e04dfe96af
Merge branch 'stable' into next-minor 2022-01-01 17:55:17 +00:00
Dylan K. Taylor
c8247786d7
Player: check chat length check with strlen() before mb_strlen()
mb_strlen() is O(n), whereas strlen() is O(1). If we receive very large chat messages (e.g. 2 MB), mb_strlen() will take a very long time to return a result (around 8ms on my machine).
Since the max size of a UTF-8 character is 4 bytes (according to standard), we can use strlen() with 4x the char limit to gate it and prevent this from happening.
2022-01-01 16:46:00 +00:00
Dylan T
f486b5f4a7
Player: fixed fall damage when sprinting down stairs (#4685)
Due to the way positions are updated over the network, we only see the end result of a movement and not its preceding actions. In addition, we don't know for sure whether the MCPE collision checks work the same exact way as PM.

TL;DR: It's possible for the client to capture and send a movement frame after they collided with a step and then already moved forward from it some distance, resulting in a weird arc pattern.

This PR checks the range between the old and new positions for collision boxes to ensure that all possible areas are checked for detecting fall damage.

This has been tested and successfully resolves various issues involving running down stairs:
- missing sounds
- random fall damage
2022-01-01 15:41:19 +00:00
Dylan K. Taylor
207f7ec309
Player: avoid unnecessary network updates on repeated calls to setAllowFLight(), setHasBlockCollision() and setAutoJump() 2021-12-29 20:22:16 +00:00
Dylan K. Taylor
5c994e4a24
Player: removed an old hack for setFlying() feedback loop
this is no longer a concern, since we now check if the sent state matches the current state before doing anything, at multiple layers.
2021-12-29 18:41:11 +00:00