137 Commits

Author SHA1 Message Date
Dylan K. Taylor
df7a1fcba6
Changes for 1.19.20 2022-08-09 19:06:05 +01:00
Dylan K. Taylor
baf75089f5
Entity: cancel fire damage for fireproof entities 2022-07-14 19:53:25 +01:00
Dylan K. Taylor
06655bee78
Updated to 1.19.10 2022-07-13 00:59:49 +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
c0b15de504
Modernize private static property declarations 2022-05-17 21:55:16 +01:00
Dylan K. Taylor
ec6769a6fc
Modernize private property declarations in src/entity 2022-05-17 20:42:17 +01:00
Dylan K. Taylor
6e372d9e36
Entity: fixed setNameTagVisible not having immediately visible effect 2022-05-01 14:54:41 +01:00
Dylan T
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
Dylan K. Taylor
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
Dylan K. Taylor
5c0eb92d81
Entity: harden setRotation(), setMotion(), addMotion() and teleport() against NaN/INF values 2022-03-09 22:36:44 +00:00
Dylan K. Taylor
1e88412a8f
Entity: harden constructor against dodgy locations containing NaN/INF components 2022-03-09 22:31:24 +00:00
Dylan K. Taylor
5ef73ca9aa
Entity: Remove outdated comment 2022-03-09 18:02:57 +00:00
Dylan K. Taylor
8f525ab399
Replace disallowed operators in src/entity/ 2022-01-20 19:14:28 +00:00
Dylan K. Taylor
e04dfe96af
Merge branch 'stable' into next-minor 2022-01-01 17:55:17 +00:00
Dylan K. Taylor
54d6b83fc2
Entity: pass the appropriate value for AFFECTED_BY_GRAVITY 2022-01-01 15:39:46 +00:00
Dylan K. Taylor
62afa2f28d
Entity: extract getBlocksIntersected() from getBlocksAroundWithEntityInsideActions() 2021-12-29 23:04:54 +00:00
Dylan K. Taylor
c858c0dc79
Merge remote-tracking branch 'origin/stable' into next-minor 2021-12-27 16:09:20 +00:00
XenialDan
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
Dylan K. Taylor
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
Dylan K. Taylor
ea1fceece2
Merge branch 'legacy/pm3' into stable 2021-12-14 23:15:53 +00:00
Dylan K. Taylor
c6c992a1f0
Preparations for negative Y support 2021-11-08 17:28:22 +00:00
Dylan K. Taylor
e34364412b
Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
Dylan K. Taylor
a78248a19c
Merge commit '71f2a34616961d6328f06fd911b6d4450a61643e' 2021-11-01 17:33:02 +00:00
Dylan K. Taylor
8a2ecfe1d4
Merge branch 'stable' 2021-10-29 19:04:01 +01:00
Dylan K. Taylor
32a34d2494
Location: change order of constructor parameters
to be consistent with Position::__construct() and Location::fromObject() (although Location::fromObject() has no choice, thanks to the anti-feature known as late static binding ...)
2021-10-29 15:43:09 +01:00
Dylan K. Taylor
c77829f4ad
Migrate packet creation to use ::create() methods in all but one case
MovePlayerPacket doesn't yet have a ::create() due to a complication with fields that aren't always present.
2021-10-23 01:46:01 +01:00
Dylan K. Taylor
c773e43eda
Updated BedrockProtocol to pmmp/BedrockProtocol@97fa88e9ef 2021-10-23 01:16:45 +01:00
Dylan K. Taylor
aa53dc6709
Entity: fixed network properties not updating when fireTicks changes
another bug that LBSG knew about, but didn't report. :/
2021-10-09 23:57:37 +01:00
Dylan T
4111d92b98
Stop hardcoding chunk dimensions everywhere (#4443) 2021-09-10 16:13:25 +01:00
Dylan K. Taylor
931c3ed77d
Entity: fixed current movement not being accounted for in fall height
this caused incorrect damage when falling from heights, as well as a bug in #4434.
2021-09-06 12:53:52 +01:00
Dylan K. Taylor
956780c6a6
Entity: add getters and setters for fallDistance 2021-09-05 23:59:04 +01:00
Dylan K. Taylor
ded778f422
Implemented bed bouncing 2021-09-05 20:11:49 +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
73cc841d0b
Entity: rename checkBlockCollisions() to checkBlockIntersections() 2021-09-05 14:00:27 +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
Dylan K. Taylor
7e82cafdeb
Entity: remove a bunch of commented code that no one cares about 2021-09-05 13:27:48 +01:00
marshall
6e68e99ec0
Added PlayerEntityInteractEvent (#4374) 2021-08-24 11:56:10 +01:00
Dylan K. Taylor
83805a3406
Entity: use match in checkObstruction() 2021-08-17 20:44:49 +01:00
Dylan K. Taylor
91d54ff0ad
Removed unnecessary and/or obsolete GC hacks
the intent of these hacks was to break cyclic references to avoid having objects lingering in memory. However, all of the stuff that's being removed in this commit no longer has any effect anyway, due to the fact that these things don't circularly reference each other anymore. Notably, Tile inventories now keep Position instead of a Tile ref.
2021-06-30 19:16:25 +01:00
Dylan K. Taylor
11b483f2dc
Inline EntityDataHelper::createBaseNBT()
this is only used for saving entity data now, and its presence here is allowing plugin devs to keep abusing it.
2021-06-19 18:45:21 +01:00
Dylan K. Taylor
5a14c1cb89
Entity: don't rebuild metadata every tick unless an associated property changed
this should improve performance back to PM3 levels.
2021-05-17 20:05:52 +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
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
69cb0ba1bb
Entity: don't flag as closed until just before cycle destruction
this allows stuff that requires a non-cycle-destroyed state to still operate during onDispose().
2021-03-19 01:00:49 +00:00
Dylan K. Taylor
053a7a1a61
Entity: split getSyncedNetworkData() into two functions
to avoid opaque boolean parameters
2021-01-08 13:59:52 +00:00
Dylan K. Taylor
e53b57732b
Entity: replace separate height/width/eyeHeight fields with an EntitySizeInfo structure
this will make it easier to implement stuff like sleeping (properly), swimming and gliding without needing to duplicate all the fields.
2021-01-08 00:11:01 +00:00
Dylan K. Taylor
793081d803
Entity: assume that position has a valid World during setPosition() 2020-12-27 19:20:37 +00:00
Dylan K. Taylor
bcc3e87730
Timings: rename core timers to remove 'timer' from the names
this makes them shorter and more consistent.
2020-12-23 17:52:25 +00:00
Dylan K. Taylor
dd58a95ae5 Move last-known-position tracking to World instead of Entity 2020-12-10 18:28:40 +00:00