mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
Green Thumb requires a hoe, sneak to break with a hoe
This commit is contained in:
@ -26,6 +26,8 @@ import com.gmail.nossr50.util.random.RandomChanceUtil;
|
||||
import com.gmail.nossr50.util.skills.RankUtils;
|
||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||
import com.gmail.nossr50.util.sounds.SoundManager;
|
||||
import com.gmail.nossr50.util.sounds.SoundType;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@ -667,17 +669,19 @@ public class HerbalismManager extends SkillManager {
|
||||
* @param greenTerra boolean to determine if greenTerra is active or not
|
||||
*/
|
||||
private void processGreenThumbPlants(BlockState blockState, BlockBreakEvent blockBreakEvent, boolean greenTerra) {
|
||||
if(blockBreakEvent.getPlayer().isSneaking() || !ItemUtils.isHoe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())) {
|
||||
return;
|
||||
}
|
||||
|
||||
BlockData blockData = blockState.getBlockData();
|
||||
|
||||
if (!(blockData instanceof Ageable))
|
||||
if (!(blockData instanceof Ageable)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ageable ageable = (Ageable) blockData;
|
||||
|
||||
//If the ageable is NOT mature and the player is NOT using a hoe, abort
|
||||
if(!isAgeableMature(ageable) && !ItemUtils.isHoe(getPlayer().getItemInHand())) {
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = getPlayer();
|
||||
PlayerInventory playerInventory = player.getInventory();
|
||||
@ -729,6 +733,8 @@ public class HerbalismManager extends SkillManager {
|
||||
|
||||
playerInventory.removeItem(seedStack);
|
||||
player.updateInventory(); // Needed until replacement available
|
||||
//Play sound
|
||||
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED);
|
||||
|
||||
new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0);
|
||||
}
|
||||
|
@ -98,6 +98,8 @@ public class SoundManager {
|
||||
return Sound.ENTITY_ENDER_EYE_DEATH;
|
||||
case GLASS:
|
||||
return Sound.BLOCK_GLASS_BREAK;
|
||||
case ITEM_CONSUMED:
|
||||
return Sound.ITEM_BOTTLE_EMPTY;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ public enum SoundType {
|
||||
ABILITY_ACTIVATED_BERSERK,
|
||||
BLEED,
|
||||
GLASS,
|
||||
ITEM_CONSUMED,
|
||||
TIRED;
|
||||
|
||||
public boolean usesCustomPitch()
|
||||
|
@ -4,6 +4,10 @@ Sounds:
|
||||
# 1.0 = Max volume
|
||||
# 0.0 = No Volume
|
||||
MasterVolume: 1.0
|
||||
ITEM_CONSUMED:
|
||||
Enable: true
|
||||
Volume: 1.0
|
||||
Pitch: 1.0
|
||||
GLASS:
|
||||
Enable: true
|
||||
Volume: 1.0
|
||||
|
Reference in New Issue
Block a user