From 95c403a467f4ddc1759882b906885f83b79c8526 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Wed, 19 Feb 2020 17:31:00 -0800 Subject: [PATCH] More tweaks to GT --- .../skills/herbalism/HerbalismManager.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 423778ce0..8ff40c286 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -140,12 +140,19 @@ public class HerbalismManager extends SkillManager { } //Check if the plant was recently replanted - if(blockBreakEvent.getBlock().getMetadata(mcMMO.REPLANT_META_KEY).size() >= 1) { - if(blockBreakEvent.getBlock().getMetadata(mcMMO.REPLANT_META_KEY).get(0).asBoolean()) { - //Crop is recently replanted to back out of destroying it - blockBreakEvent.setCancelled(true); + if(blockBreakEvent.getBlock().getBlockData() instanceof Ageable) { + Ageable ageableCrop = (Ageable) blockBreakEvent.getBlock().getBlockData(); - return; + if(blockBreakEvent.getBlock().getMetadata(mcMMO.REPLANT_META_KEY).size() >= 1) { + if(blockBreakEvent.getBlock().getMetadata(mcMMO.REPLANT_META_KEY).get(0).asBoolean()) { + if(isAgeableMature(ageableCrop)) { + blockBreakEvent.getBlock().removeMetadata(mcMMO.REPLANT_META_KEY, mcMMO.p); + } else { + //Crop is recently replanted to back out of destroying it + blockBreakEvent.setCancelled(true); + return; + } + } } } @@ -756,9 +763,10 @@ public class HerbalismManager extends SkillManager { //Immature plants will start over at 0 if(!isAgeableMature(ageable)) { - blockBreakEvent.setCancelled(true); +// blockBreakEvent.setCancelled(true); startReplantTask(0, blockBreakEvent, blockState, true); - blockState.setType(Material.AIR); +// blockState.setType(Material.AIR); + blockBreakEvent.setDropItems(false); return true; }