-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Category: APIRelated to the plugin APIRelated to the plugin APIType: EnhancementContributes features or other improvements to PocketMine-MPContributes features or other improvements to PocketMine-MP
Description
Problem description
Currently, if a block needs to perform an action depending on whether it was clicked by a fertilizer (or not), we have to use instanceof. In most cases, this seems fine, but when it's repeated many times, I wonder if there might be a cleaner solution.
In addition, as described in #6102, plugins actually do not have much control over the action performed by the fertilizer:
- the block spawn table: ability to add/remove/modify the percentage of blocks?
- cancel fertilization without having to cancel the entire block interaction
- precisely manage the growth of the block in question.
Proposed solution
- A BlockFertilizeEvent. Give some control but add code shit in all growing blocks and don't give much control on the spawn table : need to recalculate alls blocks if you want just a different percentage.
- The first solution combined with a seperate dedicated spawn table utility
- Maybe more ? Idk
Alternative solutions or workarounds
- Cancelling block interaction -> preventing other logics to be processed
- Cancelling block placing ? Looks difficult to detect
- Overriding the block in question -> whereas some blocks already delegate to utilities (like Grass)
kostamax27 and nicholass003
Metadata
Metadata
Assignees
Labels
Category: APIRelated to the plugin APIRelated to the plugin APIType: EnhancementContributes features or other improvements to PocketMine-MPContributes features or other improvements to PocketMine-MP