Commit Graph

82 Commits

Author SHA1 Message Date
0051b34797 Living: fixed turtle helmet being non-removable and spamming inventory updates
closes #5786
2023-07-18 12:58:07 +01:00
bea878e9e9 Implement anvil fall damage (#5312) 2023-03-27 20:17:08 +01:00
abd4ef01eb Merge branch 'minor-next' into major-next 2023-03-15 23:02:41 +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
9b4b960eb2 Remove deprecated methods 2023-01-08 17:07: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
1d4b6dc66e Only reduce durability when armor reduced damage. (#5444)
https://minecraft.fandom.com/wiki/Durability#Armor_durability
2022-12-05 21:10:36 +00:00
28d8526d8d Merge branch 'next-minor' into next-major 2022-11-30 20:05:30 +00:00
d476a4c1aa Implement a Living::getDisplayName() (#5384) 2022-11-27 19:48:55 +00:00
8dc0d506f4 Merge branch 'next-minor' into next-major 2022-10-11 22:29:21 +01:00
6ae7cb288e Merge remote-tracking branch 'origin/stable' into next-minor 2022-10-11 21:59:40 +01:00
1c6a2b66f7 Merge remote-tracking branch 'origin/next-minor' into next-major 2022-09-29 22:38:26 +01:00
cd4bb91676 Living: alter eye height so the player doesn't drown on the surface of water when swimming
fixes #4989
2022-09-29 00:15:07 +01:00
1366a43c22 Implement Turtle Shell (#5235) 2022-09-28 18:19:15 +01:00
bda0ca23b4 Living: deprecated hasLineOfSight() 2022-09-28 17:34:51 +01:00
a6cc611e9f Merge branch 'next-minor' into next-major 2022-09-28 01:06:11 +01:00
5e5661de75 Play burp sound when consuming a FoodSource (#5158) 2022-09-27 17:21:55 +01:00
1ff69136a3 Merge branch 'next-major' into modern-world-support 2022-06-07 20:01:40 +01:00
aa9f8781ff Merge branch 'next-minor' into next-major 2022-06-07 19:56:26 +01:00
d2613039ed Replace BlockLegacyIds usages with BlockTypeIds where possible 2022-06-05 21:17:10 +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
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
39b8daeeec Living: fixed a usage of hardcoded numeric ID 2022-05-25 22:23:14 +01: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
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
b9b1ba9526 Include eye height in Living->lookAt() calculation (#4440) 2021-09-08 21:54:32 +01:00
ded778f422 Implemented bed bouncing 2021-09-05 20:11:49 +01:00
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
6b7e671794 Living: use Vector3->down() instead of subtract(). 2021-09-05 14:12:04 +01:00
17dfd2cc52 Living: Trigger fall sounds on the nearest collidable block below
we can't have landed on it unless it actually has a collision box - otherwise, we only landed _in_ it.
This assumes, of course, that no blocks have bounding boxes >= 2 blocks tall, which currently none do.
2021-09-05 14:10:54 +01:00
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
6ecad153ea Entity: remove fallDistance parameter from fall() 2021-09-05 13:34:43 +01:00
77138c5c06 Living: changed bad parameter name 2021-07-22 15:46:08 +01:00
e803ca0e06 Living: Limit vertical knockback to 0.4 by default
this will break non-standard use cases with large forces, but they only have to stick a 'null' at the end of the parameter list.
Since this function should be primarily used for vanilla knockback, it makes more sense to keep the default as vanilla, but allow people to change it if they want to.

closes #4106 (this is close to #4106 anyway, but small enough that it was easier to recreate it than pull and modify it)
closes #2707
2021-07-22 14:27:20 +01:00
2312511be6 Living: remove unnecessary double CompoundTag::getTag() call 2021-06-29 23:54:52 +01:00
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
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
d76883a5f8 Merge branch 'stable' 2020-12-29 18:00:09 +00:00
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
341d8747b7 Living: wipe out effect add/remove hooks onDispose() 2020-12-01 18:27:10 +00:00
8be0c0da0d Implemented a silent property on entities and Entity->broadcastSound()
fixes #3516
2020-10-31 16:07:18 +00:00
3f254bd49c Separated effects' MCPE ID registration from VanillaEffects 2020-10-24 18:52:20 +01:00
a01c086481 Introduced VanillaEnchantments registry 2020-10-23 20:48:19 +01:00
7b02cc3efd Implemented #3836: Replace setCancelled() in events with cancel() and uncancel()
The motivation for this is to prevent passing a dynamic argument to cancellation, which in almost all cases is a bug in user code. This same mistake also appears in a few places in the PM core (as seen in this commit), but in those cases the mistakes were mostly harmless since they were taking place before the event was actually called.
closes #3836
2020-09-26 14:31:56 +01:00
db7fb25196 Avoid more Vector3 mutations using withComponents() 2020-09-25 18:40:13 +01:00
279abb871d Remove all usages of CompoundTag->hasTag()
in pretty much every case, these usages really wanted to read the tag's contents anyway, which can be combined with a getTag() and instanceof call for more concise and static analysis friendly code.
In the few cases where the tag contents wasn't needed, it still wanted to check the type, which, again, can be done in a more static analysis friendly way by just using getTag() and instanceof.
2020-07-10 21:01:43 +01:00