Browse Source

Merge pull request #278 from Glitchfinder/master

Basic update for 1.4.2
Grant 12 years ago
parent
commit
fa96a6beec

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

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

+ 33 - 0
src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java

@@ -201,6 +201,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;
@@ -223,6 +237,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);
                 }
@@ -306,6 +327,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);

+ 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