282 Commits

Author SHA1 Message Date
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
Dylan K. Taylor
661848c5e7
fix more EOF newlines 2022-01-07 20:39:43 +00:00
Dylan K. Taylor
75fc7a2d1f
Merge branch 'stable' into next-minor 2022-01-07 20:16:35 +00:00
Dylan K. Taylor
6d249026cc
Merge branch 'legacy/pm3' into stable 2022-01-07 20:15:15 +00:00
Dylan K. Taylor
fb29653ed7
Merge remote-tracking branch 'origin/stable' into next-minor 2022-01-06 22:43:57 +00:00
Dylan T
6492cac5c1
Merge pull request from GHSA-c6fg-99pr-25m9 2022-01-04 20:40:55 +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
eedea38669
Improve performance of loading player inventories 2022-01-01 15:26:42 +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
ShockedPlot7560
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
Dylan K. Taylor
dbad5dd611
Merge branch 'stable' into next-minor 2021-12-14 23:16:01 +00:00
Dylan K. Taylor
ea1fceece2
Merge branch 'legacy/pm3' into stable 2021-12-14 23:15:53 +00:00
Dylan K. Taylor
a94b88424e
Merge branch 'stable' into next-minor 2021-12-10 19:15:57 +00:00
Dylan K. Taylor
bcf8a3424c
Merge branch 'legacy/pm3' into stable 2021-12-10 18:02:06 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
8b73549355
Use JSON_THROW_ON_ERROR for json_encode() and json_decode() 2021-12-08 19:14:07 +00:00
Dylan K. Taylor
1d14c8cb6b
Merge branch 'stable' into next-minor 2021-12-07 00:41:48 +00:00
Rush2929
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
Dylan K. Taylor
6e4b73c183
FallingBlock: fixed crash when block is unable to be determined 2021-12-06 16:40:47 +00:00
Dylan K. Taylor
5c7125f190
Improved error handling for loading broken entity / tile data 2021-11-23 17:41:26 +00:00
Rush2929
b34e6f53eb
Changed visibility of Projectile->move to Protected. (#4585) 2021-11-19 23:21:10 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
eb9012401b
Merge branch 'stable' 2021-11-08 19:53:56 +00:00
Dylan K. Taylor
19a3efe893
....... 2021-11-08 18:57:14 +00:00
Dylan K. Taylor
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
Dylan K. Taylor
f93b5be789
Added new dynamic StringToEffectParser 2021-11-08 18:49:28 +00:00
Dylan K. Taylor
c6c992a1f0
Preparations for negative Y support 2021-11-08 17:28:22 +00:00
Dylan K. Taylor
579ef63663
EntityDataHelper: accept FloatTag for vector3 as well as Double
MCPE uses Float for entity positions.
2021-11-04 20:46:34 +00:00
Dylan K. Taylor
54f287feb6
Merge branch 'stable' 2021-11-04 19:27:41 +00:00
Dylan K. Taylor
e34364412b
Replace InvalidStateException usages with InvalidArgument or LogicException 2021-11-02 16:05:54 +00:00
Dylan K. Taylor
f827a555d5
Merge branch 'stable' 2021-11-01 18:13:24 +00:00
Dylan K. Taylor
6175b03433
Merge commit 69952ae2aff244715b986d35c3ed041863fb39ef 2021-11-01 17:36:34 +00:00
Dylan K. Taylor
a78248a19c
Merge commit '71f2a34616961d6328f06fd911b6d4450a61643e' 2021-11-01 17:33:02 +00:00
Dylan K. Taylor
08f3c18de9
Arrow: do not add pickups to creative players' inventories
closes #2932
2021-10-30 17:16:46 +01: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
ee9f5e0044
Location: make __construct() parameters mandatory
I did consider allowing yaw/pitch to remain optional, but considering the implicit immutability of Location, it really doesn't make any sense to create a Location with default yaw/pitch - just create a Position in that case instead.
2021-10-29 15:40:58 +01:00
Dylan K. Taylor
04aedc6494
Updated BedrockProtocol 2021-10-23 23:54:49 +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
c70b80c273
ItemEntity: implement partial itemstack pickups in the dumbest way possible
Given the various limitations and flexibilities posed by EntityItemPickupEvent, I settled on this as the simplest way to deal with the problem.

- EntityItemPickupEvent may have its destination inventory changed, so we can't cache the result of getAddableItemQuantity() to use after the event.
- The item itself may have changed, so even if we thought we could add some items before the change, we might not be able to afterwards.

Considering the above facts, it's better to just give the whole itemstack to EntityItemPickupEvent, and let plugins use getAddableItemQuantity() on their own to decide if their chosen inventory can accommodate the item or not.
If it can't, then we'll just drop it on the ground.
This also fixes a potential issue where plugins changing the item to a custom one might end up with their items and the actual items both just vanishing if the target inventory was full.
closes #4499
2021-10-17 22:37:49 +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 K. Taylor
0ad663ff50
Merge remote-tracking branch 'origin/stable' 2021-10-05 01:17:59 +01:00
Dylan T
4111d92b98
Stop hardcoding chunk dimensions everywhere (#4443) 2021-09-10 16:13:25 +01:00
marshall
b9b1ba9526
Include eye height in Living->lookAt() calculation (#4440) 2021-09-08 21:54:32 +01:00