浏览代码

Added Horses to Taming.

GJ 11 年之前
父节点
当前提交
7eec53d621

+ 3 - 0
Changelog.txt

@@ -8,6 +8,9 @@ Key:
   - Removal
 
 Version 1.4.07-dev
+ + Added ability to summon horses via Call of the Wild using apples
+ + Added XP gain to Taming for horses
+ + Added new permission nodes to allow more control over Taming and Call of the Wild
  + Added new experience.yml config file! Moved all experience related settings from config.yml to experience.yml
  + Added support for EXPONENTIAL formula curves to experience.yml
  + Added new /mcconvert command to convert players levels and experience from one formula curve to another.

+ 2 - 12
src/main/java/com/gmail/nossr50/config/Config.java

@@ -382,21 +382,11 @@ public class Config extends AutoUpdateConfigLoader {
     public boolean getUnarmedBlockCrackerSmoothbrickToCracked() { return config.getBoolean("Skills.Unarmed.Block_Cracker.SmoothBrick_To_CrackedBrick", true); }
 
     /* Taming */
+    public int getTamingCOTWHorseCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Apples_Required", 10); }
     public int getTamingCOTWWolfCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Bones_Required", 10); }
     public int getTamingCOTWOcelotCost() { return config.getInt("Skills.Taming.Call_Of_The_Wild.Fish_Required", 10); }
     public double getTamingCOTWRange() { return config.getDouble("Skills.Taming.Call_Of_The_Wild.Range", 40); }
-    public int getTamingCOTWAmount(EntityType type) {
-        switch (type) {
-            case OCELOT:
-                return config.getInt("Skills.Taming.Call_Of_The_Wild.Ocelot_Amount", 1);
-
-            case WOLF:
-                return config.getInt("Skills.Taming.Call_Of_The_Wild.Wolf_Amount", 1);
-
-            default:
-                return 1;
-        }
-    }
+    public int getTamingCOTWAmount(EntityType type) { return config.getInt("Skills.Taming.Call_Of_The_Wild." + StringUtils.getPrettyEntityTypeString(type)+ "_Amount"); }
 
     /* Woodcutting */
     public boolean getOakDoubleDropsEnabled() { return config.getBoolean("Double_Drops.Woodcutting.Oak", true); }

+ 1 - 0
src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java

@@ -184,6 +184,7 @@ public class ExperienceConfig extends AutoUpdateConfigLoader {
     public double getRepairXP(RepairMaterialType repairMaterialType) { return config.getDouble("Experience.Repair." + StringUtils.getCapitalized(repairMaterialType.toString())); }
 
     /* Taming */
+    public int getTamingXPHorse() { return config.getInt("Experience.Taming.Animal_Taming.Horse", 1000); }
     public int getTamingXPWolf() { return config.getInt("Experience.Taming.Animal_Taming.Wolf", 250); }
     public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); }
 

+ 20 - 8
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

@@ -571,17 +571,29 @@ public class PlayerListener implements Listener {
             case LEFT_CLICK_AIR:
             case LEFT_CLICK_BLOCK:
 
+                if (!player.isSneaking()) {
+                    break;
+                }
+
                 /* CALL OF THE WILD CHECKS */
-                if (player.isSneaking()) {
-                    Material type = heldItem.getType();
-                    TamingManager tamingManager = mcMMOPlayer.getTamingManager();
+                Material type = heldItem.getType();
+                TamingManager tamingManager = mcMMOPlayer.getTamingManager();
 
-                    if (type == Material.RAW_FISH) {
-                        tamingManager.summonOcelot();
-                    }
-                    else if (type == Material.BONE) {
+                switch (type) {
+                    case APPLE:
+                        tamingManager.summonHorse();
+                        break;
+
+                    case BONE:
                         tamingManager.summonWolf();
-                    }
+                        break;
+
+                    case RAW_FISH:
+                        tamingManager.summonOcelot();
+                        break;
+
+                    default:
+                        break;
                 }
 
                 break;

+ 1 - 0
src/main/java/com/gmail/nossr50/skills/taming/Taming.java

@@ -34,6 +34,7 @@ public class Taming {
 
     public static int wolfXp   = ExperienceConfig.getInstance().getTamingXPWolf();
     public static int ocelotXp = ExperienceConfig.getInstance().getTamingXPOcelot();
+    public static int horseXp  = ExperienceConfig.getInstance().getTamingXPHorse();
 
     public static boolean canPreventDamage(Tameable pet, AnimalTamer owner) {
         return pet.isTamed() && owner instanceof Player && pet instanceof Wolf;

+ 15 - 0
src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java

@@ -66,6 +66,10 @@ public class TamingManager extends SkillManager {
      */
     public void awardTamingXP(LivingEntity entity) {
         switch (entity.getType()) {
+            case HORSE:
+                applyXpGain(Taming.horseXp);
+                return;
+
             case WOLF:
                 applyXpGain(Taming.wolfXp);
                 return;
@@ -148,6 +152,17 @@ public class TamingManager extends SkillManager {
         callOfTheWild(EntityType.WOLF, Config.getInstance().getTamingCOTWWolfCost());
     }
 
+    /**
+     * Summon a horse to your side.
+     */
+    public void summonHorse() {
+        if (!Permissions.callOfTheWild(getPlayer(), EntityType.HORSE)) {
+            return;
+        }
+
+        callOfTheWild(EntityType.HORSE, Config.getInstance().getTamingCOTWHorseCost());
+    }
+
     /**
      * Handle the Beast Lore ability.
      *

+ 2 - 0
src/main/resources/config.yml

@@ -246,12 +246,14 @@ Skills:
         Call_Of_The_Wild:
             Bones_Required: 10
             Fish_Required: 10
+            Apples_Required: 10
 
             # Range to check for nearby pets when using Call Of The Wild, 0 will disable the check
             Range: 40
             # Amount of pets to summon when using Call Of The Wild
             Wolf_Amount: 1
             Ocelot_Amount: 1
+            Horse_Amount: 1
     Unarmed:
         Enabled_For_PVP: true
         Enabled_For_PVE: true

+ 1 - 0
src/main/resources/experience.yml

@@ -139,6 +139,7 @@ Experience:
         Animal_Taming:
             Wolf: 250
             Ocelot: 500
+            Horse: 1000
     Combat:
         Multiplier:
             Animals: 1.0

+ 3 - 0
src/main/resources/plugin.yml

@@ -548,9 +548,12 @@ permissions:
     mcmmo.ability.taming.callofthewild.all:
         description: Allows access to the Call of the Wild abilities
         children:
+            mcmmo.ability.taming.callofthewild.horse: true
             mcmmo.ability.taming.callofthewild.ocelot: true
             mcmmo.ability.taming.callofthewild.renamepets: true
             mcmmo.ability.taming.callofthewild.wolf: true
+    mcmmo.ability.taming.callofthewild.horse:
+        description: Allows players to summon Horses with Call of the Wild
     mcmmo.ability.taming.callofthewild.ocelot:
         description: Allows players to summon Ocelots with Call of the Wild
     mcmmo.ability.taming.callofthewild.renamepets: