Commit Graph

300 Commits

Author SHA1 Message Date
ec6769a6fc Modernize private property declarations in src/entity 2022-05-17 20:42:17 +01:00
89cc449808 Update exhaustion values for 1.18.30 (#5034) 2022-05-17 18:28:19 +01:00
9ff1bf6deb Merge remote-tracking branch 'origin/stable' into next-minor 2022-05-11 13:12:45 +01:00
6e372d9e36 Entity: fixed setNameTagVisible not having immediately visible effect 2022-05-01 14:54:41 +01:00
937bb4c6ce Merge branch 'stable' into next-minor 2022-04-28 21:00:23 +01:00
20ff5d5a3d Modernize property declarations in src/entity/animation 2022-04-28 15:33:13 +01:00
c085bf0db4 Changes for 1.18.30 2022-04-20 13:59:50 +01:00
e388cb1643 Merge branch 'stable' into next-minor 2022-04-10 21:23:04 +01:00
d1dfbd95e2 Entity: workaround teleport client bug #4394 by despawning and respawning the entity (#4870)
this is a sucky solution but it works well enough for this scenario.

From my research it appears that while the client-side MovementInterpolator is active on the client and hasn't yet reached its target, any teleport sent during the lerp will get overridden by the lerp.
This appears to last 3-4 ticks (about 150-200 ms) which explains why this can be reproduced by stopping movement just before the ender pearl lands (human reaction times would make the reproduction unreliable otherwise).

Things to note:
- All entities are affected by this bug.
- MovePlayerPacket appears not to have the problem, but we can't use it because it doesn't work for non-players.
- MoveActorAbsolute and MoveActorDelta are both handled by the same code and will have the same lerping bug.

This is the cleanest solution I could come up with.
2022-04-08 23:12:01 +01:00
ab93135b84 Merge branch 'stable' into next-minor 2022-03-22 15:49:58 +00:00
2b8a54f8ff Entity: added a guard to prevent __construct() from running multiple times
this typically happens due to flawed logic in child classes in plugins which causes parent::__construct() to get called multiple times.
2022-03-22 15:33:31 +00:00
05fdd94754 fix CS 2022-03-12 00:57:32 +00:00
05792826bc EntityFactory: use import aliases to improve readability slightly 2022-03-09 23:39:45 +00:00
5c0eb92d81 Entity: harden setRotation(), setMotion(), addMotion() and teleport() against NaN/INF values 2022-03-09 22:36:44 +00:00
1e88412a8f Entity: harden constructor against dodgy locations containing NaN/INF components 2022-03-09 22:31:24 +00:00
6d584cf008 EntityDataHelper: prevent INF/NaN being loaded from disk to come back and break things after the fact 2022-03-09 22:16:07 +00:00
5ef73ca9aa Entity: Remove outdated comment 2022-03-09 18:02:57 +00:00
90a369f0b6 Humans can now do emotes (#4610)
added the following API methods:
- Human::emote()
2022-03-03 18:19:30 +00:00
fc53f3721a Avoid direct mutations of Entity->location 2022-01-20 21:49:14 +00:00
8f525ab399 Replace disallowed operators in src/entity/ 2022-01-20 19:14:28 +00:00
661848c5e7 fix more EOF newlines 2022-01-07 20:39:43 +00:00
75fc7a2d1f Merge branch 'stable' into next-minor 2022-01-07 20:16:35 +00:00
6d249026cc Merge branch 'legacy/pm3' into stable 2022-01-07 20:15:15 +00:00
fb29653ed7 Merge remote-tracking branch 'origin/stable' into next-minor 2022-01-06 22:43:57 +00:00
6492cac5c1 Merge pull request from GHSA-c6fg-99pr-25m9 2022-01-04 20:40:55 +00:00
e04dfe96af Merge branch 'stable' into next-minor 2022-01-01 17:55:17 +00:00
54d6b83fc2 Entity: pass the appropriate value for AFFECTED_BY_GRAVITY 2022-01-01 15:39:46 +00:00
eedea38669 Improve performance of loading player inventories 2022-01-01 15:26:42 +00:00
62afa2f28d Entity: extract getBlocksIntersected() from getBlocksAroundWithEntityInsideActions() 2021-12-29 23:04:54 +00:00
c858c0dc79 Merge remote-tracking branch 'origin/stable' into next-minor 2021-12-27 16:09:20 +00:00
d41f933e7b Implement swimming/gliding including AABB recalculation (#4446)
- The following events have been added:
  - PlayerToggleGlideEvent
  - PlayerToggleSwimEvent
- The following API methods have been added:
  - Entity->getSize()
  - Living->isSwimming()
  - Living->setSwimming()
  - Living->isGliding()
  - Living->setSwimming()
  - Player->toggleSwim()
  - Player->toggleGlide()
2021-12-19 17:10:41 +00:00
e3614d1a82 Entity: fixed game performance issue with large scale entities
this->size refers to the scaled height, but the client wants the base (unscaled) size in these properties.
This caused immense lag when, for example, setting the scale of a player to 10, because their collision box would become 180 by 60, instead of the expected 18 by 6.
2021-12-18 22:38:45 +00:00
de82424fb2 XpManager: add APIs to prevent owning Human from attracting XP orbs (#4623)
Fixes #4589

The following API methods are added:

- `XpManager->canAttractXpOrbs()`
- `XpManager->setCanAttractXpOrbs()`

Possible future scope: flip this on its head to allow spectator players to attract XP orbs, in case someone wants that for some reason ???

Co-authored-by: Dylan K. Taylor <dktapps@pmmp.io>
2021-12-15 04:40:46 +00:00
dbad5dd611 Merge branch 'stable' into next-minor 2021-12-14 23:16:01 +00:00
ea1fceece2 Merge branch 'legacy/pm3' into stable 2021-12-14 23:15:53 +00:00
a94b88424e Merge branch 'stable' into next-minor 2021-12-10 19:15:57 +00:00
bcf8a3424c Merge branch 'legacy/pm3' into stable 2021-12-10 18:02:06 +00:00
1ed9302f5a ItemEntity: clone items given to the constructor directly
this fixes some bizarre mutability issues that occurred when using World->dropItem() with the same object multiple times.
2021-12-10 16:31:56 +00:00
8b73549355 Use JSON_THROW_ON_ERROR for json_encode() and json_decode() 2021-12-08 19:14:07 +00:00
1d14c8cb6b Merge branch 'stable' into next-minor 2021-12-07 00:41:48 +00:00
8f2ca92f02 Implement dropped item merging (#4419)
- The following classes have been added:
  - `ItemMergeEvent`
  - `ItemEntityStackSizeChangeAnimation`
- The following API methods have been added:
  - `ItemEntity->isMergeable()`
  - `ItemEntity->tryMergeInto()`
  - `ItemEntity->setStackSize()`
2021-12-06 22:23:18 +00:00
6e4b73c183 FallingBlock: fixed crash when block is unable to be determined 2021-12-06 16:40:47 +00:00
5c7125f190 Improved error handling for loading broken entity / tile data 2021-11-23 17:41:26 +00:00
b34e6f53eb Changed visibility of Projectile->move to Protected. (#4585) 2021-11-19 23:21:10 +00:00
c3ec9c0948 Effect default duration is once again NOT hardcoded, like PM3
I have no fucking idea why I hardcoded this to begin with. Not one of my better ideas ...
2021-11-09 01:52:47 +00:00
eb9012401b Merge branch 'stable' 2021-11-08 19:53:56 +00:00
19a3efe893 ....... 2021-11-08 18:57:14 +00:00
a1ecdc27e5 Removed Vanilla*::fromString()
these were misbegotten and should never have existed.
If someone really needs these for some reason, they can use getAll()[name].
2021-11-08 18:52:14 +00:00
f93b5be789 Added new dynamic StringToEffectParser 2021-11-08 18:49:28 +00:00
c6c992a1f0 Preparations for negative Y support 2021-11-08 17:28:22 +00:00