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

Shulkerboxes don't drop themself while player is in creative mode #4417

Open
ColinHDev opened this issue Aug 29, 2021 · 3 comments · May be fixed by #4652
Open

Shulkerboxes don't drop themself while player is in creative mode #4417

ColinHDev opened this issue Aug 29, 2021 · 3 comments · May be fixed by #4652
Labels
Category: Gameplay Related to Minecraft gameplay experience Status: Not Implemented

Comments

@ColinHDev
Copy link
Contributor

ColinHDev commented Aug 29, 2021

Issue description

Shulkerboxes are meant to drop themselves when they are broken by a player in creative mode and their inventory isn't empty.
Because of how block breaking is implemented in PocketMine-MP it is currently impossible to let a block drop anything while the player is in creative mode.
https://github.com/pmmp/PocketMine-MP/blob/master/src/world/World.php#L1653

Steps to reproduce the issue

  1. Go into creative mode.
  2. Place a shulkerbox and fill its inventory with items.
  3. Break the shulkerbox and see that it doesn't drop.

Possible solutions

  • The block class could get two additional functions which would be called in the World::useBreakOn(...) function when a player breaks a block in creative mode.
    • Block::getCreativeDrops() : Item[] which returns the drops of that block while the player would be in creative mode. The function would simply return an empty array while the ShulkerBox class could overwrite that function to implement the block dropping.
    • Block::getCreativeXpDrop() : int which would be the creative mode opposite of Block::getXpDropForTool(Item) : int which would return the dropped amount of xp when the block is broken in creative mode. At the moment, this function had no use. Right now furnaces don't give xp, either when collecting from them or when breaking them. (Furnaces don't produce xp #4418) If this would be added in the future, the Block::getCreativeXpDrop() : int function could be used to let the xp also drop when a furnace is broken by a player in creative mode.
@dktapps dktapps added Category: Gameplay Related to Minecraft gameplay experience Status: Not Implemented labels Sep 3, 2021
@dktapps
Copy link
Member

dktapps commented Sep 9, 2021

Another possible solution is to override Block->onBreak() to drop the item. Not ideal though, since it won't show in BlockBreakEvent.

@ColinHDev
Copy link
Contributor Author

that's why I suggested creative opposites of the current drop methods.
Alternatively, the drop methods could accept a player variable

@ColinHDev
Copy link
Contributor Author

but I think explosions depend on that function

ShockedPlot7560 added a commit to ShockedPlot7560/PocketMine-MP that referenced this issue Dec 14, 2021
@ShockedPlot7560 ShockedPlot7560 linked a pull request Dec 14, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Gameplay Related to Minecraft gameplay experience Status: Not Implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants