Browse Source

[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"

t00thpick1 8 years ago
parent
commit
f1ac5739e4

+ 1 - 0
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;
         }

+ 3 - 3
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";
             }

+ 6 - 6
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