refactor name

This commit is contained in:
Leijurv 2019-01-14 19:52:31 -08:00
parent f8681d179d
commit ae3fc14b52
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 4 additions and 4 deletions

View File

@ -78,7 +78,7 @@ public class InventoryBehavior extends Behavior {
continue; continue;
} }
if (klass.isInstance(stack.getItem())) { if (klass.isInstance(stack.getItem())) {
double speed = ToolSet.calculateStrVsBlock(stack, against.getDefaultState()); // takes into account enchants double speed = ToolSet.calculateSpeedVsBlock(stack, against.getDefaultState()); // takes into account enchants
if (speed > bestSpeed) { if (speed > bestSpeed) {
bestSpeed = speed; bestSpeed = speed;
bestInd = i; bestInd = i;

View File

@ -103,7 +103,7 @@ public class ToolSet {
IBlockState blockState = b.getDefaultState(); IBlockState blockState = b.getDefaultState();
for (byte i = 0; i < 9; i++) { for (byte i = 0; i < 9; i++) {
ItemStack itemStack = player.inventory.getStackInSlot(i); ItemStack itemStack = player.inventory.getStackInSlot(i);
double v = calculateStrVsBlock(itemStack, blockState); double v = calculateSpeedVsBlock(itemStack, blockState);
if (v > value) { if (v > value) {
value = v; value = v;
best = i; best = i;
@ -128,7 +128,7 @@ public class ToolSet {
*/ */
private double getBestDestructionTime(Block b) { private double getBestDestructionTime(Block b) {
ItemStack stack = player.inventory.getStackInSlot(getBestSlot(b)); ItemStack stack = player.inventory.getStackInSlot(getBestSlot(b));
return calculateStrVsBlock(stack, b.getDefaultState()); return calculateSpeedVsBlock(stack, b.getDefaultState());
} }
/** /**
@ -138,7 +138,7 @@ public class ToolSet {
* @param state the blockstate to be mined * @param state the blockstate to be mined
* @return how long it would take in ticks * @return how long it would take in ticks
*/ */
public static double calculateStrVsBlock(ItemStack item, IBlockState state) { public static double calculateSpeedVsBlock(ItemStack item, IBlockState state) {
float hardness = state.getBlockHardness(null, null); float hardness = state.getBlockHardness(null, null);
if (hardness < 0) { if (hardness < 0) {
return -1; return -1;