Add BlockBreakBlockEvent#4989
Conversation
|
EnvironmentalBlockDropEvent? ExternalBlockDropEvent? |
|
I got an idea. |
|
|
|
BlockBreakByEnvironmentItemDropEvent :D |
|
I like ExternalBlockDropEvent as suggested by ExcessiveAmountOfZombies. |
|
DropItemByEnvironmentalBlockBreakEvent |
|
Imo. the naming difficulty exposes a completely different issue: The event only gets called on a block drop, not on the block break making it impossible to cancel that event as well as getting the drop. Imo. that should be combined to one event which both handles the actual block breaking as well as the drop catching. Edit: Granted, the implementation might not be possible that way and the Player block breaking also consists of two events (which I don't really like) :S That could also make the naming easier:
|
6b4d91f to
497f6a4
Compare
|
K, rebased (somehow I forgot this one after md_5's nms repackage), and I went with |
497f6a4 to
d1216e9
Compare
|
Rebased for 1.17.1 |
d1216e9 to
2a6f0da
Compare
|
a |
|
Is there anything still blocking this PR? This feature would be really helpful for the plugin I am currently creating... |
| + public static boolean dropResources(BlockState blockState, LevelAccessor generatorAccess, BlockPos blockPosition, BlockPos source, @Nullable BlockEntity tileEntity) { | ||
| + if (generatorAccess instanceof ServerLevel) { | ||
| + List<org.bukkit.inventory.ItemStack> items = com.google.common.collect.Lists.newArrayList(); | ||
| + for (net.minecraft.world.item.ItemStack drop : net.minecraft.world.level.block.Block.getDrops(blockState, generatorAccess.getMinecraftWorld(), blockPosition, tileEntity)) { |
There was a problem hiding this comment.
Fully qualified name here could be replaced with var but it's no biggie
2a6f0da to
260ef1a
Compare
So not really sure what to call this event, but there wasn't a way to affect the drops when water or a piston breaks a block. So this adds that. Kind of an odd name I know, but if you've got a better one, suggest away please.