Fix issues where paxels could not destroy blocks that did not have a specific tooltypes harvest level set on them. #5604, #5606, #5621

This commit is contained in:
pupnewfster committed 2019-08-23 19:23:03 -04:00
1 parent a70f1392d6
commit c21ce3febb
1 file changed
+12
@@ -2,9 +2,12 @@ package mekanism.tools.item;
import java.util.HashSet;
import java.util.List;
import javax.annotation.Nonnull;
import mekanism.common.util.LangUtils;
import mekanism.tools.common.IHasRepairType;
import mekanism.tools.common.Materials;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
@@ -31,6 +34,15 @@ public class ItemMekanismPaxel extends ItemTool implements IHasRepairType {
list.add(LangUtils.localize("tooltip.hp") + ": " + (itemstack.getMaxDamage() - itemstack.getItemDamage()));
}
@Override
public float getDestroySpeed(@Nonnull ItemStack stack, IBlockState state) {
Material material = state.getMaterial();
//TODO: 1.14 Double check the various items to see if their getDestroySpeed short paths changed
boolean pickaxeShortcut = material == Material.IRON || material == Material.ANVIL || material == Material.ROCK;
boolean axeShortcut = material == Material.WOOD || material == Material.PLANTS || material == Material.VINE;
return pickaxeShortcut || axeShortcut ? this.efficiency : super.getDestroySpeed(stack, state);
}
@Override
public ItemStack getRepairStack() {
return toolMaterial.getRepairItemStack();