mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-24 06:06:45 +01:00
changes the dev asked for
This commit is contained in:
parent
e50e984c65
commit
028b561e66
@ -763,22 +763,22 @@ public class HerbalismManager extends SkillManager {
|
||||
|
||||
switch (blockState.getType().getKey().getKey().toLowerCase(Locale.ROOT)) {
|
||||
case "carrots":
|
||||
seed = Material.CARROT;
|
||||
seed = Material.matchMaterial("CARROT");
|
||||
break;
|
||||
case "wheat":
|
||||
seed = Material.WHEAT_SEEDS;
|
||||
seed = Material.matchMaterial("WHEAT_SEEDS");
|
||||
break;
|
||||
case "nether_wart":
|
||||
seed = Material.NETHER_WART;
|
||||
seed = Material.matchMaterial("NETHER_WART");
|
||||
break;
|
||||
case "potatoes":
|
||||
seed = Material.POTATO;
|
||||
seed = Material.matchMaterial("POTATO");
|
||||
break;
|
||||
case "beetroots":
|
||||
seed = Material.BEETROOT_SEEDS;
|
||||
seed = Material.matchMaterial("BEETROOT_SEEDS");
|
||||
break;
|
||||
case "cocoa":
|
||||
seed = Material.COCOA_BEANS;
|
||||
seed = Material.matchMaterial("COCOA_BEANS");
|
||||
break;
|
||||
case "torchflower":
|
||||
seed = Material.matchMaterial("TORCHFLOWER_SEEDS");
|
||||
@ -804,6 +804,14 @@ public class HerbalismManager extends SkillManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!processGrowingPlants(blockState, ageable, blockBreakEvent, greenTerra)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the SubSkillEvent before removing items
|
||||
if (EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, blockState.getBlock()).isCancelled()) {
|
||||
return false;
|
||||
} else {
|
||||
// Remove seed from the appropriate inventory slot (main hand or off-hand)
|
||||
if (playerInventory.getItemInMainHand().getType() == seed) {
|
||||
playerInventory.removeItem(new ItemStack(seed, 1));
|
||||
@ -813,13 +821,6 @@ public class HerbalismManager extends SkillManager {
|
||||
|
||||
player.updateInventory(); // Needed until replacement available
|
||||
|
||||
if (!processGrowingPlants(blockState, ageable, blockBreakEvent, greenTerra)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, blockState.getBlock()).isCancelled()) {
|
||||
return false;
|
||||
} else {
|
||||
// Play sound
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user