Fix #133 by adding Enchantments to Survival Fastbreak Calculation.

This commit is contained in:
SuPaH sPii committed 2013-01-02 14:06:56 -06:00
1 parent 24d551468c
commit 75959dbdd9
4 files changed
+44 -1

No files matched your search

@@ -26,8 +26,10 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.NumberConversions;
public final class Utilities {
@@ -182,10 +184,15 @@ public final class Utilities {
public static long calcSurvivalFastBreak(ItemStack tool, Material block) {
double bhardness = BlockHardness.getBlockHardness(block);
double thardness = ToolHardness.getToolHardness(tool.getType());
long enchantlvl = (long) tool.getEnchantmentLevel(Enchantment.DIG_SPEED);
long result = (long) ((long) Math.round((bhardness * thardness) * 0.10 * 10000));
result += 150;
if (enchantlvl > 0)
result /= enchantlvl * enchantlvl + 1L;
if (result > 25000)
result = 25000;
else if (result < 0) result = 0;