From 641284215491751f49f18f7f92a5f427ea847b40 Mon Sep 17 00:00:00 2001 From: zrdzn Date: Wed, 4 May 2022 20:07:42 +0200 Subject: [PATCH] GH-22 Fix legacy drops --- .../minecraft/lovelydrop/drop/DropListener.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/drop/DropListener.java b/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/drop/DropListener.java index 1cdc02d..54f2d2f 100644 --- a/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/drop/DropListener.java +++ b/plugin/src/main/java/io/github/zrdzn/minecraft/lovelydrop/drop/DropListener.java @@ -67,7 +67,17 @@ public void onSourceBreak(BlockBreakEvent event) { Block block = event.getBlock(); - MaterialData source = block.getState().getData(); + MaterialData source = null; + for (MaterialData legacyData : this.dropItemCache.getDrops().keySet()) { + if (block.getType() == legacyData.getItemType() && block.getData() == legacyData.getData()) { + source = legacyData; + break; + } + } + + if (source == null) { + return; + } // Get optional drops from source blocks. Set sourceDrops = this.dropItemCache.getDrops(source);