From f1ac5739e4681fb3e14849baf3738a0df97a3a95 Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Tue, 1 Aug 2017 01:33:02 -0400 Subject: [PATCH] [bugfix] Resolve issues with Herbalism exp. Due to flaws the previous changes to the configuration system combined with some bad lines in the experience.config that I mistakenly recommended, herbalism was not granting experience in most cases, as it was marking newly planted crops and such as player placed no exp granting blocks, rather than ignoring them as it should. block types now are evaluated in 3 steps: 1: Explicit Name i.e. ("Crops|4", "Crops|0"), Which is the material name then data value 2: "friendly name" i.e. ("Crops_Ripe", "Crops_Ungrown"), Which is a typically data valueless name, some of which I make up in mcMMO, but most of which are just the Material name 3: Wildcard name i.e. ("Crops|*") Which is any block with that block value, regardless of data value In order to be sure herbalism grants exp for you once again, make sure your configuration for herbalism looks similar to this: https://github.com/mcMMO-Dev/mcMMO/blob/master/src/main/resources/experience.yml#L151 In terms of which blocks are listed there. Specifically, there should be no blocks marked "ungrown" --- .../nossr50/skills/herbalism/HerbalismManager.java | 1 + .../java/com/gmail/nossr50/util/StringUtils.java | 6 +++--- src/main/resources/experience.yml | 12 ++++++------ 3 files changed, 10 insertions(+), 9 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 1ee27761f..7657a6128 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -125,6 +125,7 @@ public class HerbalismManager extends SkillManager { Material material = blockState.getType(); boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE_BLOCK); + // Prevents placing and immediately breaking blocks for exp if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) { return; } diff --git a/src/main/java/com/gmail/nossr50/util/StringUtils.java b/src/main/java/com/gmail/nossr50/util/StringUtils.java index 15b9cf4e8..688a27b2c 100644 --- a/src/main/java/com/gmail/nossr50/util/StringUtils.java +++ b/src/main/java/com/gmail/nossr50/util/StringUtils.java @@ -295,19 +295,19 @@ public class StringUtils { case POTATO : case CROPS : { if (((Crops) data).getState() == CropState.RIPE) { - return getPrettyItemString(data.getItemType()).replace(" ", "_"); + return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe"; } return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown"; } case NETHER_WARTS : { if (((NetherWarts) data).getState() == NetherWartsState.RIPE) { - return getPrettyItemString(data.getItemType()).replace(" ", "_"); + return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe"; } return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown"; } case COCOA : { if (((CocoaPlant) data).getSize() == CocoaPlantSize.LARGE) { - return getPrettyItemString(data.getItemType()).replace(" ", "_"); + return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe"; } return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown"; } diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index 1bd9d2048..43ee881e0 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -151,25 +151,25 @@ Experience: Herbalism: Allium: 300 Azure_Bluet: 150 - Beetroot_Block: 50 + Beetroot_Block_Ripe: 50 Blue_Orchid: 150 Brown_Mushroom: 150 Cactus: 30 - Carrot: 50 + Carrot_Ripe: 50 Chorus_Flower: 25 Chorus_Plant: 1 - Cocoa: 30 - Crops: 50 + Cocoa_Ripe: 30 + Crops_Ripe: 50 Dead_Bush: 30 Lilac: 50 Melon_Block: 20 - Nether_Warts: 50 + Nether_Warts_Ripe: 50 Orange_Tulip: 150 Oxeye_Daisy: 150 Peony: 50 Pink_Tulip: 150 Poppy: 100 - Potato: 50 + Potato_Ripe: 50 Pumpkin: 20 Red_Mushroom: 150 Red_Tulip: 150