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.ItemSpade;
import net.minecraft.item.ItemStack;
import java.util.Set;
public class ItemGenericShovel extends ItemSpade {
private int harvestLevel;
private Object repairMaterial;
public ItemGenericShovel(ToolMaterial toolMaterial, Object repairMat) {
super(toolMaterial);
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("shovel");
}
@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);
}
}