根因:block.getDrops() 不带工具参数时,矿物掉落原矿方块(COPPER_ORE)
而非矿石物品(COPPER_RAW_ORE)。连锁≥5个时部分方块掉落不完整。
修复:block.getDrops() → block.getDrops(hand)
传入玩家手中工具,矿物→矿石物品,树木→原木,自动正确
This commit is contained in:
@@ -4095,8 +4095,10 @@ public class Main extends JavaPlugin
|
||||
for (org.bukkit.block.Block block : sameTypeBlocks) {
|
||||
if (block.getType() != targetType) continue;
|
||||
|
||||
// 用 block.getDrops() 获取正确掉落物(矿物→矿石物品,自动处理深板岩)
|
||||
java.util.Collection<org.bukkit.inventory.ItemStack> drops = block.getDrops();
|
||||
// 用 block.getDrops(hand) 获取正确掉落物
|
||||
// 矿物需要镐子 → 掉落矿石物品(COPPER_ORE→COPPER_RAW_ORE)
|
||||
// 树木需要斧头 → 掉落原木
|
||||
java.util.Collection<org.bukkit.inventory.ItemStack> drops = block.getDrops(hand);
|
||||
for (org.bukkit.inventory.ItemStack drop : drops) {
|
||||
org.bukkit.entity.Item item = (org.bukkit.entity.Item)
|
||||
world.dropItemNaturally(dropCenter, drop);
|
||||
|
||||
Reference in New Issue
Block a user