Add custom mobs automatically as they're killed.

This commit is contained in:
GJ
2013-09-25 10:42:19 -04:00
committed by TfT_02
parent 4a0fee5796
commit a63f745c73
15 changed files with 336 additions and 298 deletions

View File

@ -5,6 +5,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType;
@ -98,7 +99,7 @@ public class AxesManager extends SkillManager {
if (ItemUtils.isArmor(armor) && Axes.impactChance > Misc.getRandom().nextInt(getActivationChance())) {
double durabilityModifier = 1 / (armor.getEnchantmentLevel(Enchantment.DURABILITY) + 1); // Modifier to simulate the durability enchantment behavior
double modifiedDurabilityDamage = durabilityDamage * durabilityModifier;
short maxDurability = armor.getType().getMaxDurability();
short maxDurability = mcMMO.getRepairableManager().getRepairable(armor.getType()).getMaximumDurability();
double maxDurabilityDamage = maxDurability * Axes.impactMaxDurabilityModifier;
armor.setDurability((short) (Math.min(modifiedDurabilityDamage, maxDurabilityDamage) + armor.getDurability()));

View File

@ -87,7 +87,7 @@ public class Repair {
protected static int getSalvagedAmount(ItemStack inHand) {
// Temporary workaround until they get their stuff fixed.
if (mcMMO.p.getServer().getName().equals("MCPC+")) {
if (ItemUtils.isPickaxe(inHand) || ItemUtils.isAxe(inHand) || inHand.getType() == Material.BOW || inHand.getType() == Material.BUCKET) {
if (ItemUtils.isPickaxe(inHand) || ItemUtils.isAxe(inHand) || ItemUtils.isBow(inHand) || inHand.getType() == Material.BUCKET) {
return 3;
}
else if (ItemUtils.isShovel(inHand) || inHand.getType() == Material.FLINT_AND_STEEL) {
@ -120,7 +120,7 @@ public class Repair {
int quantity = 0;
MaterialData repairData = new MaterialData(repairMaterial, repairMetadata);
Recipe recipe = mcMMO.p.getServer().getRecipesFor(item).get(0);
if (recipe instanceof ShapelessRecipe) {
for (ItemStack ingredient : ((ShapelessRecipe) recipe).getIngredientList()) {
if (ingredient != null && ingredient.getType() == repairMaterial && (repairMetadata == -1 || ingredient.getData() == repairData)) {