Axes extend ItemAxe Fixes #1027

This commit is contained in:
ProfessorProspector 2017-03-30 18:02:58 -07:00
parent 10bbdbc4d7
commit dc638cea9c

View file

@ -29,6 +29,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemAxe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import reborncore.RebornCore;
@ -36,24 +37,15 @@ import techreborn.client.TechRebornCreativeTabMisc;
import java.util.Set;
public class ItemTRAxe extends ItemTool {
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 class ItemTRAxe extends ItemAxe {
private ToolMaterial material = ToolMaterial.WOOD;
public ItemTRAxe(ToolMaterial material) {
super(material, EFFECTIVE_ON);
super(material);
this.damageVsEntity = material.getDamageVsEntity() + 5.75F;
this.attackSpeed = (material.getDamageVsEntity() + 6.75F) * -0.344444F;
setUnlocalizedName(material.name().toLowerCase() + "Axe");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.material = material;
}
public float getStrVsBlock(ItemStack stack, IBlockState state) {
Material material = state.getMaterial();
return material != Material.WOOD && material != Material.PLANTS && material != Material.VINE
? super.getStrVsBlock(stack, state) : this.efficiencyOnProperMaterial;
}
}