From 11f1889f1f6218fa0d2f77fc8eb4a5275a9e12c4 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sun, 28 Oct 2012 20:53:03 -0700 Subject: [PATCH 1/3] Added support for carrots and potatoes. Also updated to ignore beacon blocks and anvil blocks. --- .../java/com/gmail/nossr50/config/Config.java | 4 ++++ .../nossr50/skills/gathering/Herbalism.java | 21 +++++++++++++++++++ .../com/gmail/nossr50/util/BlockChecks.java | 6 ++++++ src/main/resources/config.yml | 4 ++++ 4 files changed, 35 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 294acc952..7117c996f 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -165,6 +165,8 @@ public class Config extends ConfigLoader { public int getHerbalismXPLilyPads() { return config.getInt("Experience.Herbalism.Lily_Pads", 100); } public int getHerbalismXPVines() { return config.getInt("Experience.Herbalism.Vines", 10); } public int getHerbalismXPCocoa() { return config.getInt("Experience.Herbalism.Cocoa",30); } + public int getHerbalismXPCarrot() { return config.getInt("Experience.Herbalism.Carrot",30); } + public int getHerbalismXPPotato() { return config.getInt("Experience.Herbalism.Potato",30); } public boolean getHerbalismGreenThumbCobbleToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.Cobble_To_Mossy", true); } public boolean getHerbalismGreenThumbSmoothbrickToMossy() { return config.getBoolean("Skills.Herbalism.Green_Thumb.SmoothBrick_To_MossyBrick", true); } @@ -183,6 +185,8 @@ public class Config extends ConfigLoader { public boolean getWaterLiliesDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Water_Lilies", true); } public boolean getYellowFlowersDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Yellow_Flowers", true); } public boolean getCocoaDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Cocoa", true); } + public boolean getCarrotDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Carrot", true); } + public boolean getPotatoDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Herbalism.Potato", true); } public boolean herbalismDoubleDropsDisabled() { ConfigurationSection section = config.getConfigurationSection("Double_Drops.Herbalism"); diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index beaaa762a..d30b49570 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -199,6 +199,20 @@ public class Herbalism { } break; + case CARROT: + if (((byte) data) == 0x3) { + mat = Material.CARROT; + xp = Config.getInstance().getHerbalismXPCarrot(); + } + break; + + case POTATO: + if (((byte) data) == 0x3) { + mat = Material.POTATO; + xp = Config.getInstance().getHerbalismXPPotato(); + } + break; + default: if (Config.getInstance().getBlockModsEnabled() && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(new ItemStack(block.getTypeId(), 1, (short) 0, block.getData()))) { customPlant = true; @@ -221,6 +235,13 @@ public class Herbalism { if (mat == Material.COCOA) { is = new ItemStack(Material.INK_SACK, 1, (short) 3); } + else if (mat == Material.COCOA) { + is = new ItemStack(Material.CARROT_ITEM, 1, (short) 0); + } + else if (mat == Material.COCOA) { + is = new ItemStack(Material.POTATO_ITEM, 1, (short) 0); + } + else { is = new ItemStack(mat); } diff --git a/src/main/java/com/gmail/nossr50/util/BlockChecks.java b/src/main/java/com/gmail/nossr50/util/BlockChecks.java index 83dfc6817..6b2128ade 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockChecks.java +++ b/src/main/java/com/gmail/nossr50/util/BlockChecks.java @@ -54,6 +54,8 @@ public class BlockChecks { case YELLOW_FLOWER: case COCOA: case EMERALD_ORE: + case CARROT: + case POTATO: return true; default: @@ -98,6 +100,8 @@ public class BlockChecks { case WALL_SIGN: case WOODEN_DOOR: case WORKBENCH: + case BEACON: + case ANVIL: return false; default: @@ -179,6 +183,8 @@ public class BlockChecks { case WATER_LILY: case YELLOW_FLOWER: case COCOA: + case CARROT: + case POTATO: return true; case CROPS: diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d1237b8f8..625d75df9 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -198,6 +198,8 @@ Double_Drops: Wheat: true Yellow_Flowers: true Cocoa: true + Carrot: true + Potato: true Mining: Coal: true Diamond: true @@ -267,6 +269,8 @@ Experience: Lily_Pads: 100 Vines: 10 Cocoa: 30 + Carrot: 50 + Potato: 50 Mining: Sandstone: 30 Glowstone: 30 From 2a20ed95fa05e3d2aaadffa30ef9704a988b006f Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sun, 28 Oct 2012 20:56:33 -0700 Subject: [PATCH 2/3] Added missed checks for potatoes and carrots. --- .../gmail/nossr50/skills/gathering/Herbalism.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index d30b49570..17d375f0c 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -325,6 +325,18 @@ public class Herbalism { } break; + case CARROT: + if (configInstance.getCarrotDoubleDropsEnabled()) { + Misc.dropItem(location, is); + } + break; + + case POTATO: + if (configInstance.getPotatoDoubleDropsEnabled()) { + Misc.dropItem(location, is); + } + break; + default: if (customPlant) { CustomBlock customBlock = ModChecks.getCustomBlock(block); From db0168205d6e39e2cb372d27ec6667e55a54f7b4 Mon Sep 17 00:00:00 2001 From: Glitchfinder Date: Sun, 28 Oct 2012 22:47:26 -0700 Subject: [PATCH 3/3] Added herbalism food bonuses. --- .../nossr50/listeners/EntityListener.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index f26eb9e2c..9a8ebd49c 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -284,6 +284,35 @@ public class EntityListener implements Listener { rankChange = 200; break; + case CARROT_ITEM: + /* CARROT RESTORES 2 HUNGER - RESTORES 4 1/2 HUNGER @ 1000 */ + rankChange = 200; + break; + + case POTATO_ITEM: + /* POTATO RESTORES 1/2 HUNGER - RESTORES 2 HUNGER @ 1000 */ + rankChange = 400; + break; + + case BAKED_POTATO: + /* BAKED POTATO RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */ + rankChange = 200; + break; + + case POISONOUS_POTATO: + /* POISONOUS POTATO RESTORES 1 HUNGER - RESTORES 2 1/2 HUNGER @ 1000 */ + rankChange = 400; + break; + + case GOLDEN_CARROT: + /* GOLDEN CARROT RESTORES 3 HUNGER - RESTORES 5 1/2 HUNGER @ 1000 */ + rankChange = 200; + break; + + case PUMPKIN_PIE: + /* PUMPKIN PIE RESTORES 4 HUNGER - RESTORES 6 1/2 HUNGER @ 1000 */ + rankChange = 200; + break; default: return; }