[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"
This commit is contained in:
t00thpick1 2017-08-01 01:33:02 -04:00
parent 8cbb57df97
commit f1ac5739e4
3 changed files with 10 additions and 9 deletions

View File

@ -125,6 +125,7 @@ public class HerbalismManager extends SkillManager {
Material material = blockState.getType(); Material material = blockState.getType();
boolean oneBlockPlant = !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE_BLOCK); 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)) { if (oneBlockPlant && mcMMO.getPlaceStore().isTrue(blockState)) {
return; return;
} }

View File

@ -295,19 +295,19 @@ public class StringUtils {
case POTATO : case POTATO :
case CROPS : { case CROPS : {
if (((Crops) data).getState() == CropState.RIPE) { if (((Crops) data).getState() == CropState.RIPE) {
return getPrettyItemString(data.getItemType()).replace(" ", "_"); return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe";
} }
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown"; return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
} }
case NETHER_WARTS : { case NETHER_WARTS : {
if (((NetherWarts) data).getState() == NetherWartsState.RIPE) { if (((NetherWarts) data).getState() == NetherWartsState.RIPE) {
return getPrettyItemString(data.getItemType()).replace(" ", "_"); return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe";
} }
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown"; return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
} }
case COCOA : { case COCOA : {
if (((CocoaPlant) data).getSize() == CocoaPlantSize.LARGE) { if (((CocoaPlant) data).getSize() == CocoaPlantSize.LARGE) {
return getPrettyItemString(data.getItemType()).replace(" ", "_"); return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ripe";
} }
return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown"; return getPrettyItemString(data.getItemType()).replace(" ", "_") + "_Ungrown";
} }

View File

@ -151,25 +151,25 @@ Experience:
Herbalism: Herbalism:
Allium: 300 Allium: 300
Azure_Bluet: 150 Azure_Bluet: 150
Beetroot_Block: 50 Beetroot_Block_Ripe: 50
Blue_Orchid: 150 Blue_Orchid: 150
Brown_Mushroom: 150 Brown_Mushroom: 150
Cactus: 30 Cactus: 30
Carrot: 50 Carrot_Ripe: 50
Chorus_Flower: 25 Chorus_Flower: 25
Chorus_Plant: 1 Chorus_Plant: 1
Cocoa: 30 Cocoa_Ripe: 30
Crops: 50 Crops_Ripe: 50
Dead_Bush: 30 Dead_Bush: 30
Lilac: 50 Lilac: 50
Melon_Block: 20 Melon_Block: 20
Nether_Warts: 50 Nether_Warts_Ripe: 50
Orange_Tulip: 150 Orange_Tulip: 150
Oxeye_Daisy: 150 Oxeye_Daisy: 150
Peony: 50 Peony: 50
Pink_Tulip: 150 Pink_Tulip: 150
Poppy: 100 Poppy: 100
Potato: 50 Potato_Ripe: 50
Pumpkin: 20 Pumpkin: 20
Red_Mushroom: 150 Red_Mushroom: 150
Red_Tulip: 150 Red_Tulip: 150