package eiteam.esteemedinnovation.tools.standard; import com.google.common.collect.ImmutableSet; import eiteam.esteemedinnovation.api.util.ItemStackUtility; import eiteam.esteemedinnovation.commons.EsteemedInnovation; import net.minecraft.item.ItemAxe; import net.minecraft.item.ItemStack; import java.util.Set; public class ItemGenericAxe extends ItemAxe { private int harvestLevel; private Object repairMaterial; public ItemGenericAxe(ToolMaterial toolMaterial, Object repairMat) { super(toolMaterial, 8F, -3.1F); harvestLevel = toolMaterial.getHarvestLevel(); repairMaterial = repairMat; this.setCreativeTab(EsteemedInnovation.tabTools); this.setHarvestLevel(this.getClass().getName(), toolMaterial.getHarvestLevel()); } @Override public Set<String> getToolClasses(ItemStack stack) { return ImmutableSet.of("axe"); } @Override public int getHarvestLevel(ItemStack stack, String toolClass) { return harvestLevel; } @Override public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { if (repairMaterial instanceof ItemStack) { return par2ItemStack.isItemEqual((ItemStack) repairMaterial) ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); } if (repairMaterial instanceof String) { return ItemStackUtility.isItemOreDictedAs(par2ItemStack, (String) repairMaterial) ? true : super.getIsRepairable(par1ItemStack, par2ItemStack); } return super.getIsRepairable(par1ItemStack, par2ItemStack); } }