-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
base: minor-next
Are you sure you want to change the base?
Conversation
are you sure this is a good idea tho
There was a problem hiding this 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.
use pocketmine\event\Cancellable; | ||
use pocketmine\event\CancellableTrait; | ||
|
||
class SpawnerAttemptSpawnEvent extends BlockEvent implements Cancellable{ |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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
does the author mind if i help with this pr? |
I appreciate any help, feel free to offer suggestions or PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like how much this depends on Mojang internal data. Not sure if there's currently a way to avoid this, but this is why I didn't implement mob spawners myself.
$this->spawnPerAttempt = $tile->getSpawnPerAttempt(); | ||
$this->maxNearbyEntities = $tile->getMaxNearbyEntities(); | ||
$this->spawnRange = $tile->getSpawnRange(); | ||
$this->requiredPlayerRange = $tile->getRequiredPlayerRange(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not liking this. A data class to wrap all these up into one item to be passed between block & tile would be a lot cleaner.
This PR has been marked as "Waiting on Author", but we haven't seen any activity in 7 days. If there is no further activity, it will be closed in 28 days. Note for maintainers: Adding an assignee to the PR will prevent it from being marked as stale. |
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