Green Thumb requires a hoe, sneak to break with a hoe

This commit is contained in:
nossr50 2020-02-19 16:14:21 -08:00
parent e2073ff9f7
commit 7c6d5c476d
5 changed files with 19 additions and 4 deletions

View File

@ -1,4 +1,6 @@
Version 2.1.115 Version 2.1.115
Green Thumb now requires a hoe to activate
You can sneak to break plants with a hoe in your hand (or just put the hoe away)
Hoes no longer give free replants Hoes no longer give free replants
There is now a feature in place to prevent breaking a newly automatically replanted (via green thumb) crop from being breakable for a few seconds after it appears There is now a feature in place to prevent breaking a newly automatically replanted (via green thumb) crop from being breakable for a few seconds after it appears
Using a hoe on non-fully grown crops will replant them as a convenience feature for those who can't bother to wait for all of their plants to grow (put away the hoe to break non-fully grown crops) Using a hoe on non-fully grown crops will replant them as a convenience feature for those who can't bother to wait for all of their plants to grow (put away the hoe to break non-fully grown crops)

View File

@ -26,6 +26,8 @@ import com.gmail.nossr50.util.random.RandomChanceUtil;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.util.skills.SkillUtils; 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.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; 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 * @param greenTerra boolean to determine if greenTerra is active or not
*/ */
private void processGreenThumbPlants(BlockState blockState, BlockBreakEvent blockBreakEvent, boolean greenTerra) { private void processGreenThumbPlants(BlockState blockState, BlockBreakEvent blockBreakEvent, boolean greenTerra) {
if(blockBreakEvent.getPlayer().isSneaking() || !ItemUtils.isHoe(blockBreakEvent.getPlayer().getInventory().getItemInMainHand())) {
return;
}
BlockData blockData = blockState.getBlockData(); BlockData blockData = blockState.getBlockData();
if (!(blockData instanceof Ageable)) if (!(blockData instanceof Ageable)) {
return; return;
}
Ageable ageable = (Ageable) blockData; Ageable ageable = (Ageable) blockData;
//If the ageable is NOT mature and the player is NOT using a hoe, abort //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(); Player player = getPlayer();
PlayerInventory playerInventory = player.getInventory(); PlayerInventory playerInventory = player.getInventory();
@ -729,6 +733,8 @@ public class HerbalismManager extends SkillManager {
playerInventory.removeItem(seedStack); playerInventory.removeItem(seedStack);
player.updateInventory(); // Needed until replacement available player.updateInventory(); // Needed until replacement available
//Play sound
SoundManager.sendSound(player, player.getLocation(), SoundType.ITEM_CONSUMED);
new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0); new HerbalismBlockUpdaterTask(blockState).runTaskLater(mcMMO.p, 0);
} }

View File

@ -98,6 +98,8 @@ public class SoundManager {
return Sound.ENTITY_ENDER_EYE_DEATH; return Sound.ENTITY_ENDER_EYE_DEATH;
case GLASS: case GLASS:
return Sound.BLOCK_GLASS_BREAK; return Sound.BLOCK_GLASS_BREAK;
case ITEM_CONSUMED:
return Sound.ITEM_BOTTLE_EMPTY;
default: default:
return null; return null;
} }

View File

@ -15,6 +15,7 @@ public enum SoundType {
ABILITY_ACTIVATED_BERSERK, ABILITY_ACTIVATED_BERSERK,
BLEED, BLEED,
GLASS, GLASS,
ITEM_CONSUMED,
TIRED; TIRED;
public boolean usesCustomPitch() public boolean usesCustomPitch()

View File

@ -4,6 +4,10 @@ Sounds:
# 1.0 = Max volume # 1.0 = Max volume
# 0.0 = No Volume # 0.0 = No Volume
MasterVolume: 1.0 MasterVolume: 1.0
ITEM_CONSUMED:
Enable: true
Volume: 1.0
Pitch: 1.0
GLASS: GLASS:
Enable: true Enable: true
Volume: 1.0 Volume: 1.0