瀏覽代碼

Added support for carrots and potatoes. Also updated to ignore beacon blocks and anvil blocks.

Glitchfinder 12 年之前
父節點
當前提交
11f1889f1f

+ 4 - 0
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");

+ 21 - 0
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);
                 }

+ 6 - 0
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:

+ 4 - 0
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