2016-03-28 06:20:27 +02:00
|
|
|
package techreborn.items.tools;
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
|
|
|
|
import me.modmuss50.jsonDestroyer.api.ITexturedItem;
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.item.ItemTool;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
import reborncore.RebornCore;
|
2016-03-28 10:26:54 +02:00
|
|
|
import techreborn.client.TechRebornCreativeTabMisc;
|
2016-03-28 06:20:27 +02:00
|
|
|
import techreborn.lib.ModInfo;
|
|
|
|
|
|
|
|
public class ItemTRAxe extends ItemTool implements ITexturedItem {
|
|
|
|
private ToolMaterial material = ToolMaterial.WOOD;
|
|
|
|
|
|
|
|
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 ItemTRAxe(ToolMaterial material) {
|
|
|
|
super(material, EFFECTIVE_ON);
|
|
|
|
this.damageVsEntity = material.getDamageVsEntity() + 5.75F;
|
|
|
|
this.attackSpeed = (material.getDamageVsEntity() + 6.75F) * -0.344444F;
|
|
|
|
setUnlocalizedName(material.name().toLowerCase() + "Axe");
|
2016-03-28 10:26:54 +02:00
|
|
|
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
2016-03-28 06:20:27 +02:00
|
|
|
RebornCore.jsonDestroyer.registerObject(this);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getTextureName(int damage) {
|
|
|
|
return "techreborn:items/tool/" + material.name().toLowerCase() + "_axe";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getMaxMeta() {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
|
|
|
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
|
|
|
}
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public boolean isFull3D() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|