1
0
mirror of https://github.com/pmmp/PocketMine-MP.git synced 2025-05-06 22:09:47 +00:00
Commit Graph

17849 Commits

Author SHA1 Message Date
Javier León
d3add78d3e
Add support for basic entity picking via middle-click ()
Support for more advanced stuff like NBT copying wasn't added in this PR, as the NBT used by PM is currently an inconsistent mess and doesn't play nice with vanilla. In the interests of avoiding this mess propagating, it's been left for another time.

Adds PlayerEntityPickEvent a la PlayerBlockPickEvent
and Entity->getPickedItem().
2024-11-15 21:27:10 +00:00
Dylan T.
ff695a5f97
PlayerInteractEvent: added APIs to independently control reaction of item and block ()
This allows, for example, banning the usage of spawn eggs, without preventing opening of doors, without the need for item ID whitelists.

It also allows customizing the behaviour of item and block interactions when sneaking - it's now possible to force spawn eggs to work when sneaking, or force containers to open.

Finally, this also allows preventing any interaction at all without preventing block placement (by setting both to false). Since cancelling the event will typically prevent placement too (which might not be desired).

Side note: Blocks are now always synced when right-clicking on a block.
This differs from the previous behaviour, where the blocks were only synced when the action "failed".
However, since this change introduces a situation where the action may succeed but have different results than the client expects, it's best to just always sync blocks in this situation.

Fixes 
2024-11-15 21:19:54 +00:00
Dylan T.
4b630cb726
start.sh: print warnings on unusual exit codes from the server process () 2024-11-15 21:14:21 +00:00
Dylan T.
4331f69b9c
Update team-pr-auto-approve.yml 2024-11-15 20:44:51 +00:00
github-actions
fb1213e964 Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11862895039
2024-11-15 20:21:32 +00:00
Dylan T.
8a693f2a4c
team-pr-auto-approve: Use RestrictedActions auto approver 2024-11-15 20:08:54 +00:00
bonbionseker
8474eaf5f1
Adjust Sugar Cane to break when there is no water () 2024-11-15 16:27:27 +00:00
ipad54
a75d4687ce
Implemented vanilla /xp command () 2024-11-15 16:09:55 +00:00
ipad54
0b0c425805
Extract glow lichen multi face logic into traits ()
This will be useful for future block additions
2024-11-15 15:47:26 +00:00
ipad54
b5469dede2
Flowable blocks now can't be placed inside liquid () 2024-11-15 00:10:43 +00:00
Dylan K. Taylor
e0d270a870
Merge branch 'minor-next' of github.com:pmmp/PocketMine-MP into minor-next 2024-11-14 23:14:33 +00:00
Dylan K. Taylor
2d9cee3d62
Update Language dependency 2024-11-14 23:14:23 +00:00
Dylan K. Taylor
ed64231c57
Merge branch 'stable' of github.com:pmmp/PocketMine-MP into minor-next 2024-11-14 23:12:26 +00:00
Dylan T.
33a7b46329
Use reflection to locate BlockTypeIds and ItemTypeIds for VanillaBlocks/VanillaItems ()
Use reflection to locate BlockTypeIds and ItemTypeIds for VanillaBlocks/VanillaItems

Since BlockTypeIds and ItemTypeIds are derived from VanillaBlocks and VanillaItems respectively anyway (they only exist to allow identifying blocks/items without having to create instances of them), this hack is probably OK, and reduces the chances of mistakes.
Previously it was explored to have these IDs generated by auto-incrementing in VanillaBlocks/Items and have the constants generated that way, but this proved to be too problematic because of unstable diffs no matter how we chose to sort the elements. See  for previous research on the subject.

This is obviously not a desirable hack to keep long-term. In the future it will probably make sense to redesign VanillaBlocks like so:

enum VanillaBlocks { ... }
VanillaBlocks::STONE (the type ID)
VanillaBlocks::STONE->new() (to create a block)

However, more research is needed on this, as I'd prefer not to make block creation any more verbose.
2024-11-14 17:32:22 +00:00
IvanCraft623
9b58d35516
Implement Goat horns ()
Co-authored-by: ipad54 <63200545+ipad54@users.noreply.github.com>
Co-authored-by: Dylan T. <dktapps@pmmp.io>
2024-11-14 13:57:07 +00:00
Dylan T.
d2d663b1c9
Simplify handler sorting 2024-11-14 13:11:38 +00:00
Dylan T.
117026cb83
Merge branch 'minor-next' into feat/async-events 2024-11-13 23:06:05 +00:00
Dylan K. Taylor
a7a1077676
CONTRIBUTING: changing an event from sync to async or vice versa is a BC break 2024-11-13 23:00:49 +00:00
Dylan K. Taylor
0a56cf877b
Remove unused class 2024-11-13 22:58:29 +00:00
Dylan K. Taylor
11fdf79a7c
... 2024-11-13 22:55:08 +00:00
Dylan K. Taylor
edae9f26e4
Reduce number of classes 2024-11-13 22:23:43 +00:00
Dylan K. Taylor
667656b1c6
Split AsyncHandlerListManager
this allows further code deduplication at the expense of needing 2 calls to unregister all handlers
2024-11-13 22:08:28 +00:00
Dylan K. Taylor
972a9fb201
PluginManager: ensure that handler candidates of async events with wrong return types don't attempt to register as sync events
this will cause other, more confusing errors to be thrown.

to be honest, I'm not sure if enforcing the return type here is even necessary (or desirable).
2024-11-13 21:30:24 +00:00
Dylan K. Taylor
ac1cf73f8e
Reduce code duplication 2024-11-13 21:09:52 +00:00
Dylan K. Taylor
96989d1dc4
cleanup 2024-11-13 20:44:35 +00:00
Dylan K. Taylor
8aed5d6b27
Handler inheritance is now working
this code should also perform somewhat better
2024-11-13 20:35:14 +00:00
github-actions
3629ee7e7b Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11824307499
2024-11-13 19:21:16 +00:00
Dylan K. Taylor
fa796535ff
ah hello my old friend, impossible-generics.neon
propagating generics all the way through the likes of HandlerList etc is more trouble than it's worth.
2024-11-13 19:09:52 +00:00
Dylan K. Taylor
32b1d6c0c2
Fixed test code
the test still doesn't pass, but at least it's actually testing the problem now...
2024-11-13 18:52:56 +00:00
Dylan K. Taylor
6f40c6fc1d
CS 2024-11-13 18:49:58 +00:00
Dylan K. Taylor
a6a44bde90
Fix doc comments 2024-11-13 18:49:32 +00:00
Dylan K. Taylor
409066c8f5
AsyncEvent: make the code easier to make sense of 2024-11-13 18:49:15 +00:00
Dylan K. Taylor
cb2fadeb26
Fixed bug in concurrency integration test 2024-11-13 18:47:46 +00:00
Dylan K. Taylor
a14afb4bb5
Add integration tests
most of these are failing - needs to be investigated
2024-11-13 18:39:14 +00:00
Dylan K. Taylor
db88e543fa
Fix PHPStan error 2024-11-13 16:04:27 +00:00
Dylan K. Taylor
c426677841
optimization 2024-11-13 16:03:10 +00:00
Dylan K. Taylor
17ae932d31
HandlerListManager: added getter 2024-11-13 15:36:51 +00:00
Dylan K. Taylor
8f48fe4856
Fully separate hierarchies for sync & async events
there's no way to combine these without causing type compatibility issues for one side or the other.
we might be able to use traits to reduce duplication, but the separation here seems to be necessary.
2024-11-13 15:35:41 +00:00
Dylan K. Taylor
48d2430064
Update PHPStan baseline 2024-11-13 14:58:09 +00:00
Dylan K. Taylor
b82d47dd32
Merge branch 'minor-next' into feat/async-events 2024-11-13 14:57:03 +00:00
Dylan K. Taylor
fbeb017670
Promise: allow zero promises
not supporting this has caused problems every time this function has been used in reality so far ( and ).
2024-11-13 14:55:14 +00:00
Dylan K. Taylor
86fb041a65
Merge branch 'minor-next' of github.com:pmmp/PocketMine-MP into feat/async-events 2024-11-13 14:46:32 +00:00
Dylan T.
09bf203267
Update RuntimeDataDescriber.php 2024-11-12 22:57:14 +00:00
Dylan K. Taylor
f3cc4a28e1
Easy wins for PHPStan 2.0 support 2024-11-12 22:12:54 +00:00
Dylan K. Taylor
fe70150db2
Update composer dependencies 2024-11-12 21:47:52 +00:00
Dylan T.
054538e6b7
Update PULL_REQUEST_TEMPLATE.md 2024-11-12 17:54:31 +00:00
github-actions
3586bc42a9 Merge 'stable' into 'minor-next'
Automatic merge performed by: https://github.com/pmmp/RestrictedActions/actions/runs/11802296296
2024-11-12 17:14:24 +00:00
Dylan T.
1f86949836
Create CODEOWNERS 2024-11-12 14:37:02 +00:00
dependabot[bot]
053a71c59d
Bump build/php from 084822a to a51259d () 2024-11-12 14:28:32 +00:00
github-actions
07d5046b83 5.21.2 is next
Commit created by: https://github.com/pmmp/RestrictedActions/actions/runs/11796630402
2024-11-12 11:48:59 +00:00