From 3ed0fdf330c143b4d2067bace2a829e153b3d948 Mon Sep 17 00:00:00 2001 From: minoneer Date: Fri, 27 May 2016 16:32:24 +0200 Subject: [PATCH] Add Beetroot to herbalism skill --- .../commands/skills/HerbalismCommand.java | 2 +- .../nossr50/listeners/EntityListener.java | 1 + .../skills/herbalism/HerbalismManager.java | 19 ++++++++----------- .../com/gmail/nossr50/util/BlockUtils.java | 3 +-- .../com/gmail/nossr50/util/ItemUtils.java | 2 ++ src/main/resources/config.yml | 1 + src/main/resources/experience.yml | 1 + src/main/resources/plugin.yml | 3 +++ 8 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java index b426fbd23..3f9ba5e8d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -87,7 +87,7 @@ public class HerbalismCommand extends SkillCommand { protected void permissionsCheck(Player player) { hasHylianLuck = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HYLIAN_LUCK); canGreenTerra = Permissions.greenTerra(player); - canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA); + canGreenThumbPlants = Permissions.greenThumbPlant(player, Material.CROPS) || Permissions.greenThumbPlant(player, Material.CARROT) || Permissions.greenThumbPlant(player, Material.POTATO) || Permissions.greenThumbPlant(player, Material.BEETROOT) || Permissions.greenThumbPlant(player, Material.NETHER_WARTS) || Permissions.greenThumbPlant(player, Material.COCOA); canGreenThumbBlocks = Permissions.greenThumbBlock(player, Material.DIRT) || Permissions.greenThumbBlock(player, Material.COBBLESTONE) || Permissions.greenThumbBlock(player, Material.COBBLE_WALL) || Permissions.greenThumbBlock(player, Material.SMOOTH_BRICK); canFarmersDiet = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.FARMERS_DIET); canDoubleDrop = Permissions.secondaryAbilityEnabled(player, SecondaryAbility.HERBALISM_DOUBLE_DROPS) && !skill.getDoubleDropsDisabled(); diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index c626c8f7c..13bc19bb6 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -576,6 +576,7 @@ public class EntityListener implements Listener { * RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ * 1000 */ + case BEETROOT: case BREAD: /* RESTORES 2 1/2 HUNGER - RESTORES 5 HUNGER @ 1000 */ case CARROT_ITEM: /* * RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @ diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 65d3c3c01..8d6d4ce6e 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -322,6 +322,10 @@ public class HerbalismManager extends SkillManager { seed = Material.POTATO_ITEM; break; + case BEETROOT_BLOCK: + seed = Material.BEETROOT_SEEDS; + break; + default: return; } @@ -349,6 +353,10 @@ public class HerbalismManager extends SkillManager { blockState.setMetadata(mcMMO.greenThumbDataKey, new FixedMetadataValue(mcMMO.p, (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR))); switch (blockState.getType()) { + + case POTATO: + case CARROT: + case BEETROOT_BLOCK: case CROPS: Crops crops = (Crops) blockState.getData(); @@ -374,17 +382,6 @@ public class HerbalismManager extends SkillManager { return true; - case CARROT: - case POTATO: - if (greenTerra) { - blockState.setRawData(CropState.MEDIUM.getData()); - } - else { - blockState.setRawData(greenThumbStage); - } - - return true; - case NETHER_WARTS: NetherWarts warts = (NetherWarts) blockState.getData(); diff --git a/src/main/java/com/gmail/nossr50/util/BlockUtils.java b/src/main/java/com/gmail/nossr50/util/BlockUtils.java index c00f1815e..b82cb2323 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockUtils.java +++ b/src/main/java/com/gmail/nossr50/util/BlockUtils.java @@ -147,10 +147,9 @@ public final class BlockUtils { case YELLOW_FLOWER: return true; + case BEETROOT_BLOCK: case CARROT: case POTATO: - return blockState.getRawData() == CropState.RIPE.getData(); - case CROPS: return ((Crops) blockState.getData()).getState() == CropState.RIPE; diff --git a/src/main/java/com/gmail/nossr50/util/ItemUtils.java b/src/main/java/com/gmail/nossr50/util/ItemUtils.java index 55720d868..3e05496f7 100644 --- a/src/main/java/com/gmail/nossr50/util/ItemUtils.java +++ b/src/main/java/com/gmail/nossr50/util/ItemUtils.java @@ -592,6 +592,8 @@ public final class ItemUtils { case CHORUS_FRUIT: case CHORUS_FLOWER: case POTATO_ITEM: + case BEETROOT: + case BEETROOT_SEEDS: case NETHER_WARTS: case BROWN_MUSHROOM: case RED_MUSHROOM: diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index fa068b027..1d71a994d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -408,6 +408,7 @@ Skills: ### Double_Drops: Herbalism: + Beetroot_Block: true Brown_Mushroom: true Cactus: true Carrot: true diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index 2b3f42bee..aa84d1e22 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -151,6 +151,7 @@ Experience: Herbalism: Allium: 300 Azure_Bluet: 150 + Beetroot_Block: 50 Blue_Orchid: 150 Brown_Mushroom: 150 Cactus: 30 diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 2ffcc585c..1cd3b9b05 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -340,6 +340,7 @@ permissions: mcmmo.ability.herbalism.greenthumb.plants.crops: true mcmmo.ability.herbalism.greenthumb.plants.netherwarts: true mcmmo.ability.herbalism.greenthumb.plants.potato: true + mcmmo.ability.herbalism.greenthumb.plants.beetroot: true mcmmo.ability.herbalism.greenthumb.plants.carrot: description: Allows access to the Green Thumb ability for carrots mcmmo.ability.herbalism.greenthumb.plants.cocoa: @@ -350,6 +351,8 @@ permissions: description: Allows access to the Green Thumb ability for netherwart mcmmo.ability.herbalism.greenthumb.plants.potato: description: Allows access to the Green Thumb ability for potatoes + mcmmo.ability.herbalism.greenthumb.plants.beetroot: + description: Allows access to the Green Thumb ability for beetrootes mcmmo.ability.herbalism.hylianluck: description: Allows access to the Hylian Luck ability mcmmo.ability.herbalism.shroomthumb: