SpongeAPI icon indicating copy to clipboard operation
SpongeAPI copied to clipboard

Ability to get a block's potential drops with drop chance?

Open Pulverizer opened this issue 7 years ago • 4 comments

As I am working on porting Movecraft to the SpongeAPI I have found a section of code that requires getting the potential drops of a block that the Craft is about to "harvest" (Break) so that the drops can be cancelled and added to the contents of TileEntityCarriers aboard the craft instead.

Pulverizer avatar Jan 16 '19 12:01 Pulverizer

Drop chance is nothing that can be added, as there are no chance values available in the code. Especially when working with modded items.

BrainStone avatar Jan 16 '19 13:01 BrainStone

Well, we still need to be able to get the drops as a minimum.

Pulverizer avatar Jan 16 '19 13:01 Pulverizer

Simulating a single drop should be doable.

BrainStone avatar Jan 16 '19 13:01 BrainStone

Simulating drops is doable when the implementation for simulating world#digBlock. It's been an implementation PR that hasn't been given time to test and verify everything would work properly with causes, but the implementation of that API would allow simulating drops: https://github.com/SpongePowered/SpongeCommon/pull/86

Otherwise, getting drops from a block without breaking it isn't something that we'd be able to support easily without breaking and then restoring said block because mods and tile entities that rely on a few stateful things that are involved.

gabizou avatar Jan 29 '19 20:01 gabizou