Allow axe specific enchantments on axe
Fixes
package mekanism.tools.item;
+import java.util.List;
import java.util.Set;
+import mekanism.api.util.StackUtils;
+import mekanism.common.Mekanism;
+import mekanism.common.util.LangUtils;
import mekanism.tools.common.MekanismTools;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
+import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import com.google.common.collect.Sets;
-public class ItemMekanismAxe extends ItemMekanismTool
+public class ItemMekanismAxe extends ItemAxe
{
- private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(new Block[] {Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE});
-
public ItemMekanismAxe(ToolMaterial tool)
{
- super(MekanismTools.AXE_DAMAGE.get(tool), MekanismTools.AXE_SPEED.get(tool), tool, EFFECTIVE_ON);
+ super(tool, MekanismTools.AXE_DAMAGE.get(tool), MekanismTools.AXE_SPEED.get(tool));
+ setCreativeTab(Mekanism.tabMekanism);
}
@Override
- public float getStrVsBlock(ItemStack itemstack, IBlockState blockState)
- {
- if(blockState != null && blockState.getBlock() != null && blockState.getMaterial() == Material.WOOD)
+ public void addInformation(ItemStack itemstack, EntityPlayer playerIn, List<String> list, boolean advanced)
{
- return efficiencyOnProperMaterial;
- }
- else {
- return super.getStrVsBlock(itemstack, blockState);
+ list.add(LangUtils.localize("tooltip.hp") + ": " + (itemstack.getMaxDamage() - itemstack.getItemDamage()));
}
+
+ @Override
+ public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
+ {
+ return StackUtils.equalsWildcard(ItemMekanismTool.getRepairStack(toolMaterial), repair) || super.getIsRepairable(toRepair, repair);
}
}
