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
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
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
Dylan K. Taylor
39b8daeeec
Living: fixed a usage of hardcoded numeric ID
2022-05-25 22:23:14 +01:00
Dylan K. Taylor
fc53f3721a
Avoid direct mutations of Entity->location
2022-01-20 21:49:14 +00:00
Dylan K. Taylor
8f525ab399
Replace disallowed operators in src/entity/
2022-01-20 19:14:28 +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
marshall
b9b1ba9526
Include eye height in Living->lookAt() calculation ( #4440 )
2021-09-08 21:54:32 +01:00
Dylan K. Taylor
ded778f422
Implemented bed bouncing
2021-09-05 20:11:49 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
6b7e671794
Living: use Vector3->down() instead of subtract().
2021-09-05 14:12:04 +01:00
Dylan K. Taylor
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
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
77138c5c06
Living: changed bad parameter name
2021-07-22 15:46:08 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
2312511be6
Living: remove unnecessary double CompoundTag::getTag() call
2021-06-29 23:54:52 +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
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
d76883a5f8
Merge branch 'stable'
2020-12-29 18:00:09 +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
341d8747b7
Living: wipe out effect add/remove hooks onDispose()
2020-12-01 18:27:10 +00:00
Dylan K. Taylor
8be0c0da0d
Implemented a silent property on entities and Entity->broadcastSound()
...
fixes #3516
2020-10-31 16:07:18 +00:00
Dylan K. Taylor
3f254bd49c
Separated effects' MCPE ID registration from VanillaEffects
2020-10-24 18:52:20 +01:00
Dylan K. Taylor
a01c086481
Introduced VanillaEnchantments registry
2020-10-23 20:48:19 +01:00
Dylan K. Taylor
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
Dylan K. Taylor
db7fb25196
Avoid more Vector3 mutations using withComponents()
2020-09-25 18:40:13 +01:00
Dylan K. Taylor
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
Dylan T
d585081c22
Separate consumable item interfaces from general consumable interfaces ( #3595 )
...
I wonder if there's a way to generalise item consuming beyond just eating/drinking. Stuff like lava bucket in a furnace needs the same kind of "leftover" logic.
2020-06-28 17:53:03 +01:00
Dylan K. Taylor
1f0ea0c2c7
Living: stop mutating Vector3
2020-06-27 21:51:42 +01:00
Dylan K. Taylor
7e331c590d
Use static-analysis-friendly method for getting effects from EffectManager
...
fixes 5 phpstan level 8 errors
2020-06-27 13:09:05 +01:00
Dylan K. Taylor
9e6f1c9a5a
Living: check if damager is null before trying to use it
2020-06-27 13:09:05 +01:00
Dylan K. Taylor
b58c425189
Merge branch 'next-minor'
...
# Conflicts:
# changelogs/3.12.md
# resources/vanilla
# src/VersionInfo.php
2020-06-03 13:11:30 +01:00
Dylan K. Taylor
2bf73c7a4a
Merge commit '8c5a81cf5'
...
# Conflicts:
# resources/vanilla
2020-06-03 12:50:09 +01:00
Dylan K. Taylor
c72937a4af
Merge commit '5dadf1237'
...
# Conflicts:
# resources/vanilla
2020-06-03 12:46:06 +01:00
Dylan K. Taylor
6257f717b1
Entity: make networkProperties private
...
this reduces the temptation to use it in high-level code, as well as making syncNetworkData() more useful (now it can export to many data collections, which means we can start to think about having a property cache per network session, which is more flexible)
2020-05-21 20:29:06 +01:00
Dylan K. Taylor
1aa92bd6a8
Living: Do not rely on attribute map for moveSpeed attribute access
2020-05-21 20:13:24 +01:00
Dylan K. Taylor
f77eea8c44
Living: set SPRINTING flag when it's needed, close #3521
2020-05-21 20:01:37 +01:00
Dylan K. Taylor
ec8ee29291
moving sneak & sprint properties to Living
2020-05-21 19:55:58 +01:00
Dylan K. Taylor
74e1f6320a
Store attributes as local vars, reduce usage of AttributeMap
...
ideally we want attribute map to only be used for properties that need synchronization.
2020-05-21 19:18:00 +01:00
Dylan K. Taylor
7aca41a530
Living: do not loop downwards searching for collision block, closes #3517
2020-05-20 20:33:25 +01:00
Dylan K. Taylor
45ec4645d2
Merge commit '089180fef4534b383a31a9d560a76bfaf0d16c6b'
...
# Conflicts:
# resources/vanilla
# src/entity/Living.php
2020-05-19 21:14:54 +01:00
Dylan K. Taylor
22425551ed
separate default attribute creation from Attribute into AttributeMap
2020-05-18 18:12:04 +01:00
Dylan K. Taylor
4437756987
Inventory: reduce API duplication by using a Set for viewers
2020-05-14 14:13:28 +01:00
Dylan K. Taylor
8682ea35f7
Introduce some (not great) API for entity animations
...
while this API is a bit yucky, it's a step forward for protocol isolation and offers the possibility of controlling animations by adding events.
2020-05-01 13:57:26 +01:00
Dylan K. Taylor
1969766b70
Nix some client-sided sounds, control them from the server
...
this is a necessary step to knock out the implicit assumption that every player is using the same protocol.
2020-05-01 11:52:32 +01:00
Dylan K. Taylor
4fbf4dcdc6
Rename InventoryChangeListener -> InventoryListener
2020-04-24 23:44:38 +01:00