diff --git a/src/MiNET/MiNET/Worlds/Level.cs b/src/MiNET/MiNET/Worlds/Level.cs index 631b31847..95c8a18f2 100644 --- a/src/MiNET/MiNET/Worlds/Level.cs +++ b/src/MiNET/MiNET/Worlds/Level.cs @@ -1377,7 +1377,9 @@ public void BreakBlock(Player player, BlockCoordinates blockCoordinates, BlockFa Item inHand = player.Inventory.GetItemInHand(); bool canBreak = inHand.BreakBlock(this, player, block, blockEntity); - if (!canBreak || !AllowBreak || player.GameMode == GameMode.Spectator || !OnBlockBreak(new BlockBreakEventArgs(player, this, block, null))) + List drops = new List(); + drops.AddRange(block.GetDrops(inHand ?? new ItemAir())); + if (!canBreak || !AllowBreak || player.GameMode == GameMode.Spectator || !OnBlockBreak(new BlockBreakEventArgs(player, this, block, drops))) { // Revert @@ -1385,7 +1387,7 @@ public void BreakBlock(Player player, BlockCoordinates blockCoordinates, BlockFa } else { - BreakBlock(player, block, blockEntity, inHand, face); + BreakBlock(player, block, drops, blockEntity, inHand, face); player.Inventory.DamageItemInHand(ItemDamageReason.BlockBreak, null, block); player.HungerManager.IncreaseExhaustion(0.025f); @@ -1421,11 +1423,14 @@ private static void RevertBlockAction(Player player, Block block, BlockEntity bl } } - public void BreakBlock(Player player, Block block, BlockEntity blockEntity = null, Item tool = null, BlockFace face = BlockFace.None) + public void BreakBlock(Player player, Block block, List drops = null, BlockEntity blockEntity = null, Item tool = null, BlockFace face = BlockFace.None) { block.BreakBlock(this, face); - var drops = new List(); - drops.AddRange(block.GetDrops(tool ?? new ItemAir())); + if (drops == null) + { + drops = new List(); + drops.AddRange(block.GetDrops(tool ?? new ItemAir())); + } if (blockEntity != null) { @@ -1764,4 +1769,4 @@ public BlockBreakEventArgs(Player player, Level level, Block block, List d Drops = drops; } } -} \ No newline at end of file +}