Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Monster Spawner functionality #6187

Open
wants to merge 25 commits into
base: minor-next
Choose a base branch
from

Conversation

diamond-gold
Copy link
Contributor

@diamond-gold diamond-gold commented Dec 4, 2023

Introduction

This PR implements the functionality of the Monster Spawner block

Changes

API changes

Added SpawnerAttemptSpawnEvent

Follow-up

TODO: spawn condition check (light level etc.)
TODO: spawnData, spawnPotentials

Tests

Not Tested

src/item/SpawnEgg.php Outdated Show resolved Hide resolved
src/block/tile/MonsterSpawner.php Outdated Show resolved Hide resolved
src/block/tile/MonsterSpawner.php Outdated Show resolved Hide resolved
src/block/tile/MonsterSpawner.php Outdated Show resolved Hide resolved
src/block/MonsterSpawner.php Outdated Show resolved Hide resolved
@ShockedPlot7560 ShockedPlot7560 added Category: API Related to the plugin API Category: Core Related to internal functionality Type: Enhancement Contributes features or other improvements to PocketMine-MP labels Dec 20, 2023
src/block/tile/MonsterSpawner.php Outdated Show resolved Hide resolved
src/item/SpawnEggEntityRegistry.php Outdated Show resolved Hide resolved
src/item/SpawnEggEntityRegistry.php Outdated Show resolved Hide resolved
Copy link
Member

@ShockedPlot7560 ShockedPlot7560 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By moving the logic to a block, I mean something like Noteblock where all the data is only read once and the tile is only used to store the data. At runtime, the block class is used, enough.

src/block/tile/SpawnerSpawnRangeRegistry.php Outdated Show resolved Hide resolved
src/block/tile/SpawnerSpawnRangeRegistry.php Outdated Show resolved Hide resolved
src/block/tile/SpawnerSpawnRangeRegistry.php Outdated Show resolved Hide resolved
use pocketmine\event\Cancellable;
use pocketmine\event\CancellableTrait;

class SpawnerAttemptSpawnEvent extends BlockEvent implements Cancellable{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be possible to change more values? The size, the number? Is it useful ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to allow changing those in the event, those can be changed on the spawner block

src/item/SpawnEggEntityRegistry.php Outdated Show resolved Hide resolved
@pandaa-be
Copy link
Contributor

does the author mind if i help with this pr?

@diamond-gold
Copy link
Contributor Author

does the author mind if i help with this pr?

I appreciate any help, feel free to offer suggestions or PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: API Related to the plugin API Category: Core Related to internal functionality Status: Waiting on Author Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants