Commit Graph

320 Commits

Author SHA1 Message Date
Dylan K. Taylor
0404298c74 Effect: get rid of runtimeIDs 2021-09-03 21:25:06 +01:00
Dylan K. Taylor
665f2473e1 Effect: stop using hardcoded translation keys for names 2021-09-03 20:39:02 +01:00
Dylan K. Taylor
8e58beef7f Effect: use promoted properties 2021-09-03 20:32:13 +01:00
Rush2929
c2558573e2 Fix offhand pickup (#4412) 2021-08-29 12:45:23 +01:00
marshall
6e68e99ec0 Added PlayerEntityInteractEvent (#4374) 2021-08-24 11:56:10 +01:00
SalmonDE
7fd712c1ff Refactor Block & Tile: getPos() to getPosition() (#4395)
this also changes the name of the class property 'pos' to 'position' as well as Block->getPosOffset() to Block->getPositionOffset()
2021-08-23 14:01:32 +01:00
Dylan K. Taylor
270ee5c085 Simplify registry method generation 2021-08-22 23:02:36 +01:00
Rush2929
1ce9474fce Picked up items can now be added to offhand slots. (#4360) 2021-08-22 20:36:12 +01:00
Rush2929
eb9188c309 Replace InventoryPickup*Event with EntityItemPickupEvent (#4384)
The rationale here is that inventories don't actually pick items up - their holders do.
It's especially misleading to say that an inventory is picking up an item in creative mode when the picked-up item can't actually be added to the target inventory in the first place.

This change allows a range of new functionality, such as:
- Allowing survival players to pick items up even when their inventories are full, similarly to creative players
- Changing the destination inventory of collected items (e.g. items could be redirected to the offhand or ender chest inventory, while still allowing other plugins to understand what's happening)

As an added bonus, this obsoletes one more use case for Inventory->getHolder(), bringing us one step closer to removing the cyclic reference nightmare from inventories.

The choice of naming (EntityItemPickup, instead of EntityPickupItem) is to be consistent with other events, where the word order is SubjectObjectActionEvent.
2021-08-20 22:59:35 +01:00
Dylan K. Taylor
83805a3406 Entity: use match in checkObstruction() 2021-08-17 20:44:49 +01:00
Dylan T
1afda04620 PrimedTNT: fixed fuse not getting updated client-side, closes #4333 2021-07-25 12:27:25 +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
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
2312511be6 Living: remove unnecessary double CompoundTag::getTag() call 2021-06-29 23:54:52 +01:00
Dylan K. Taylor
444d902990 Fix CS 2021-06-21 20:45:31 +01:00
Dylan K. Taylor
5d6146a01f Register missing potion types 2021-06-19 21:53:08 +01:00
Dylan K. Taylor
5387456e44 Move potion types to enum 2021-06-19 21:39:23 +01:00
Dylan K. Taylor
c07f3f5e12 fix CS 2021-06-19 19:48:30 +01:00
Dylan K. Taylor
6fea09ded4 SplashPotion: Require potionId in constructor 2021-06-19 19:47:44 +01:00
Dylan K. Taylor
fc70b625b3 ExperienceOrb: Require providing XP value in constructor 2021-06-19 19:42:13 +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
cc00b3e19b Merge remote-tracking branch 'origin/stable' 2021-06-13 15:27:29 +01:00
Jason
532d57eec7 Arrow: Save and load critical state (#4241)
Fixes #3596
2021-06-09 14:00:36 +01:00
Dylan K. Taylor
10391be615 Remove useless class 2021-05-17 20:06:28 +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
b2e806e2fa World: Harden chunk loading against bad data in entity/tile NBT 2021-05-12 12:26:41 +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
742f86e022 Rename DestroyBlockParticle -> BlockBreakParticle
closes #3461

literally every other particle/sound has the subject first, followed by the (optional) verb, and finally Particle (or Sound).
In addition, we refer to breaking blocks as 'break' everywhere except here, where we refer to it as 'destroy'.
2021-05-06 18:33:18 +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
176ca3fd2f shut 2021-05-02 14:56:56 +01:00
Dylan K. Taylor
b8645f5c15 Clean up EnderChestInventory implementation
now, EnderChestInventory is just a temporary window, much like anvil/enchanting windows. It provides a gateway to the player's PlayerEnderInventory.

This removes one of the remaining obstacles to disallowing null World in Position constructor.
2021-05-02 14:26:27 +01:00
Dylan K. Taylor
1e6d97a157 Merge branch 'stable' 2021-04-07 21:25:39 +01:00
Dylan K. Taylor
90161f24e3 Added script to update registry/enum docblocks 2021-03-22 16:00:09 +00: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
72de45f0e9 Drop pocketmine/uuid for ramsey/uuid 2021-03-16 23:03:00 +00:00
Dylan K. Taylor
c61f66d973 Removed ext-ds dependency 2021-02-11 15:40:37 +00:00
Dylan K. Taylor
fd2ebd84b4 Recognize underwater TNT 2021-02-06 23:37:05 +00:00
Dylan K. Taylor
ae75d73f48 Extract MainLoggerThread unit from MainLogger
MainLogger is no longer a Thread, as per the recent changes to pocketmine/log-pthreads.
2021-02-04 16:28:49 +00:00
Dylan K. Taylor
c70c0b55df Separate held item index change listener logic from PlayerInventory 2021-01-12 16:44:25 +00:00
Dylan K. Taylor
01c867b608 Human: make held item sync on inventory content change more consistent
before this change, setContents() wouldn't trigger a held item sync, nor would setItem(heldItemIndex, someItem).
2021-01-10 20:30:39 +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
Mohamed
5392ddf0b9 Fixed TNT broadcasting ignition sound (#3996)
closes #3952
2021-01-07 21:18:18 +00:00
Dylan K. Taylor
d76883a5f8 Merge branch 'stable' 2020-12-29 18:00:09 +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
Dylan K. Taylor
e925423749 Entity: fix chunk tracking consistency issues, fixed attempted chunk loading in origin world when teleporting to a different position in a different world 2020-12-10 18:13:18 +00:00
Dylan K. Taylor
d728160a77 Removed the cycle between Entity and Chunk
it's now the World's responsibility to manage adding/removing entities from appropriate chunks. Entities no longer know or care that chunks exist.
Entity->checkChunks() remains as-is for backwards compatibility - now it just calls the world to sync its position.
2020-12-05 00:59:16 +00:00