Commit Graph

177 Commits

Author SHA1 Message Date
ba48f258f3 Support for 1.20.70 2024-03-13 14:53:27 +00:00
920341668f Implemented working Name tag (#5209) 2024-02-19 18:46:48 +00:00
c7a358a56f World: extract getBlockCollisionBoxes() from getCollisionBoxes()
closes #6104

This function has been a footgun for anyone using it, since it also returns entity AABBs by default.
In all core use cases, this functionality was disabled, and we were paying a needless (admittedly micro) performance penalty for passing the extra useless argument and useless condition check.
2023-10-19 12:52:24 +01:00
94a17f59d2 fix(Entity): broadcastSound() not firing WorldSoundEvent (#6069) 2023-10-08 19:25:19 +01:00
763241b11f Fixed burning animations for fireproof entities
creative players are not technically fireproof; they just don't take any damage from fire
2023-07-19 12:32:00 +01:00
8414c78969 Fixed netherite items burning in lava 2023-07-19 11:49:52 +01:00
35fc9abacf Merge branch 'legacy/pm4' into stable 2023-06-09 01:34:33 +01:00
9a04481bec Entity: broadcast teleports as regular movements
fixes #5810

probably fixes #4986

#5810 was caused by the workaround for #4394, which broke in 1.20 for reasons I'm still unclear on.

As FLAG_TELEPORT does not work at all for non-player entities, and causes bugs with player entities, sending the teleport movement without the flag is the least buggy way to solve all of these issues. Having the client interpolate teleport movements is not ideal, but there doesn't seem to be a way to reliably prevent it without causing even more bugs, so this will have to do.
2023-06-09 01:24:57 +01:00
f5a1a0c9cb ÂInsert PM data version into blockstates, chunks, entities, tiles and level.dat
this information will allow us to correct for any bugs introduced by past versions.

however, we still need to propagate this information to permit actually using it when loading data.
2023-05-29 16:32:24 +01:00
edafe9d21f Entity: Rename and document isImmobile() and friends
while I could implement server-side ability to disable entity movement, I don't think that's particularly useful. However, the intended function of this (disabling client sided AI) is useful, so it makes more sense to rename it to match its functionality, rather than changing its functionality to match the name.

closes #3130
2023-05-26 14:01:21 +01:00
c878bd8289 Merge remote-tracking branch 'origin/minor-next' into major-next 2023-04-20 00:18:19 +01:00
9561ae5af7 Entity: micro optimisation for checkBlockIntersections() 2023-04-16 17:57:51 +01:00
56fbd45dd5 Entity: avoid double-checking block intersections for moving entities
fixes #1824
2023-04-16 17:38:26 +01:00
7cdab75b05 Merge branch 'minor-next' into major-next 2023-03-20 22:12:54 +00:00
2751e1ec02 replacing new Vector3(0, 0, 0) with Vector3::zero() (#5640) 2023-03-20 12:54:28 +00:00
607bdfa42f Timings: added new timers for entity move collision checks and projectile move ray tracing
projectiles get their own distinct sub-timer, since the logic is completely different from regular entities.
2023-03-19 15:49:35 +00:00
abd4ef01eb Merge branch 'minor-next' into major-next 2023-03-15 23:02:41 +00:00
337a254768 Use NetworkBroadcastUtils for broadcasting packets
this eradicates all but 4 usages of Server in Entity, which is extremely cool.
2023-03-15 22:28:51 +00:00
cc8660629b First look at shared EntityEventBroadcaster,
this improves performance in PvP servers and other areas where lots of players or entities exist in one space.

fixes #5622
2023-03-15 18:22:56 +00:00
50b8d39aba Merge branch 'next-minor' into next-major 2023-02-21 15:41:57 +00:00
59a04c971f Getter and setter for gravity (#5584)
closes #5525
2023-02-21 15:01:22 +00:00
6e2685cbbb Merge branch 'next-minor' into next-major 2022-12-18 22:25:32 +00:00
bf44edd179 Constify a bunch of NBT keys, pass 1 2022-12-18 22:12:15 +00:00
4d79aced07 Merge branch 'next-minor' into next-major 2022-12-15 19:50:27 +00:00
99996b62d6 Align PhpDoc @param tags according to PHP-CS-Fixer 2022-12-06 13:21:20 +00:00
6153a2ac70 Merge remote-tracking branch 'origin/stable' into next-minor 2022-11-04 20:51:40 +00:00
29301614e8 Remove dead comments (#5389) 2022-11-04 20:23:56 +00:00
fba4895a17 Merge branch 'next-minor' into next-major 2022-10-31 19:11:39 +00:00
b6f6671a81 Merge branch 'stable' into next-minor 2022-10-31 15:34:24 +00:00
a9361b3f8b Changes for 1.19.40 2022-10-25 23:11:41 +01:00
1c6a2b66f7 Merge remote-tracking branch 'origin/next-minor' into next-major 2022-09-29 22:38:26 +01:00
41970feb57 Entity: Fire EntitySpawnEvent/ItemSpawnEvent on the first entity tick, instead of in the constructor (#5314)
This allows plugins to modify the entity via setters in EntitySpawnEvent without their changes getting overwritten by setter calls directly after the 'new YourEntity' statement.

As well as benefiting plugins, this also clears a path for a BC-breaking change in PM5 (to have the programmer use addEntity() to spawn entities, instead of the constructor doing it, which will improve on a number of data handling aspects).

fixes #4973

This targets next-minor because it has some side effects on plugins that depended on the old behaviour, such as VanillaHopper, so it's not suitable for a patch release.
2022-09-29 22:30:12 +01:00
43a3151de3 Merge branch 'next-minor' into next-major 2022-08-14 18:49:19 +01:00
df7a1fcba6 Changes for 1.19.20 2022-08-09 19:06:05 +01:00
d4f4fda442 Merge branch 'next-minor' into next-major 2022-07-14 19:54:50 +01:00
baf75089f5 Entity: cancel fire damage for fireproof entities 2022-07-14 19:53:25 +01:00
dea0207e4e Merge branch 'next-minor' into next-major 2022-07-13 17:06:04 +01:00
06655bee78 Updated to 1.19.10 2022-07-13 00:59:49 +01:00
aa9f8781ff Merge branch 'next-minor' into next-major 2022-06-07 19:56:26 +01:00
38d6284671 Use PHP-CS-Fixer to enforce file header presence 2022-06-04 17:34:49 +01:00
7b8eeb42f6 Use typed properties in src/entity package
[bc break]
2022-06-01 21:19:02 +01:00
2029e3be20 Entity: remove dead code
[bc break]
2022-06-01 21:01:56 +01:00
6ee551c5e1 Remove premature optimisation from World::getCollidingEntities()
this is already covered in more fine-grained detail by canCollideWith().

[bc break]
2022-06-01 21:00:54 +01:00
b7e2b3e94a Entity: Require declaration of gravity and drag via abstract methods
this guarantees that subclasses will actually declare them.

[bc break]
2022-06-01 20:51:18 +01:00
c0b15de504 Modernize private static property declarations 2022-05-17 21:55:16 +01:00
ec6769a6fc Modernize private property declarations in src/entity 2022-05-17 20:42:17 +01:00
6e372d9e36 Entity: fixed setNameTagVisible not having immediately visible effect 2022-05-01 14:54:41 +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
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
5c0eb92d81 Entity: harden setRotation(), setMotion(), addMotion() and teleport() against NaN/INF values 2022-03-09 22:36:44 +00:00