From df2defe969386ec14ed0e8a88306928097acd9aa Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Wed, 24 Jul 2013 20:01:16 +0200 Subject: [PATCH] Added extra settings for Call of the Wild * Requested in issue #910 * Adds a setting to configure the range check * Adds a setting to summon multiple pets with one summon --- Changelog.txt | 1 + .../java/com/gmail/nossr50/config/Config.java | 13 ++++++ .../nossr50/skills/taming/TamingManager.java | 46 +++++++++++-------- src/main/resources/config.yml | 6 +++ 4 files changed, 48 insertions(+), 18 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 1c8e70aee..23b430fd1 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -10,6 +10,7 @@ Key: Version 1.4.07-dev + Added snow to excavation + Added new experience curve option. Cumulative curve, calculates experience needed for next level using power level. + + Added extra settings to config.yml for Call of the Wild (Taming) = Fixed bug with Skull Splitter not finding the locale string = Fixed issue where locale strings could cause the scoreboard header to be longer than 16 characters. = Fixed a bug with Beast Lore when the entity had no owner but was tamed. diff --git a/src/main/java/com/gmail/nossr50/config/Config.java b/src/main/java/com/gmail/nossr50/config/Config.java index 3e3d3324a..ac2f2e5ca 100644 --- a/src/main/java/com/gmail/nossr50/config/Config.java +++ b/src/main/java/com/gmail/nossr50/config/Config.java @@ -240,6 +240,19 @@ public class Config extends AutoUpdateConfigLoader { public int getTamingXPOcelot() { return config.getInt("Experience.Taming.Animal_Taming.Ocelot", 500); } 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; + } + } /* Woodcutting */ public int getWoodcuttingXPOak() { return config.getInt("Experience.Woodcutting.Oak", 70); } diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index ff563136a..3ff333d87 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -178,29 +178,39 @@ public class TamingManager extends SkillManager { return; } - for (Entity entity : player.getNearbyEntities(40, 40, 40)) { - if (entity.getType() == type) { - player.sendMessage(Taming.getCallOfTheWildFailureMessage(type)); - return; + double range = Config.getInstance().getTamingCOTWRange(); + if (range > 0) { + for (Entity entity : player.getNearbyEntities(range, range, range)) { + if (entity.getType() == type) { + player.sendMessage(Taming.getCallOfTheWildFailureMessage(type)); + return; + } } } - LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type); - - entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); - ((Tameable) entity).setOwner(player); - - if (type == EntityType.OCELOT) { - ((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Misc.getRandom().nextInt(3))); - } - else { - entity.setMaxHealth(20); - entity.setHealth(entity.getMaxHealth()); + int amount = Config.getInstance().getTamingCOTWAmount(type); + if (amount <= 0) { + amount = 1; } - if (Permissions.renamePets(player)) { - entity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", player.getName(), StringUtils.getPrettyEntityTypeString(entity.getType()))); - entity.setCustomNameVisible(true); + for (int i = 0; i < amount; i++) { + LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type); + + entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); + ((Tameable) entity).setOwner(player); + + if (type == EntityType.OCELOT) { + ((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Misc.getRandom().nextInt(3))); + } + else { + entity.setMaxHealth(20); + entity.setHealth(entity.getMaxHealth()); + } + + if (Permissions.renamePets(player)) { + entity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", player.getName(), StringUtils.getPrettyEntityTypeString(entity.getType()))); + entity.setCustomNameVisible(true); + } } player.setItemInHand(new ItemStack(heldItem.getType(), heldItemAmount - summonAmount)); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 4b82a8982..376789c96 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -221,6 +221,12 @@ Skills: Call_Of_The_Wild: Bones_Required: 10 Fish_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 Unarmed: Enabled_For_PVP: true Enabled_For_PVE: true