Java Code Examples for net.minecraft.item.Item#ToolMaterial

The following examples show how to use net.minecraft.item.Item#ToolMaterial . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemKotachi.java    From Sakura_mod with MIT License 5 votes vote down vote up
public ItemKotachi(Item.ToolMaterial material, String name) {
    this.material = material;
    this.maxStackSize = 1;
    this.setMaxDamage((int) (material.getMaxUses()*0.75f));
    this.setUnlocalizedName(SakuraMain.MODID + "." + name);
    this.attackDamage = material.getAttackDamage();
    this.addPropertyOverride(new ResourceLocation("blocking"), new IItemPropertyGetter() {
        @SideOnly(Side.CLIENT)
        public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
            return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
        }
    });
}
 
Example 2
Source File: ItemKatana.java    From Sakura_mod with MIT License 5 votes vote down vote up
public ItemKatana(Item.ToolMaterial material, String name) {
    this.material = material;
    this.maxStackSize = 1;
    this.setMaxDamage(material.getMaxUses());
    this.setUnlocalizedName(SakuraMain.MODID + "." + name);
    this.attackDamage = 3.0F + material.getAttackDamage();
    this.addPropertyOverride(new ResourceLocation("blocking"), new IItemPropertyGetter() {
        @SideOnly(Side.CLIENT)
        public float apply(ItemStack stack, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) {
            return entityIn != null && entityIn.isHandActive() && entityIn.getActiveItemStack() == stack ? 1.0F : 0.0F;
        }
    });
}
 
Example 3
Source File: WrappedToolMaterialImpl.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Item.ToolMaterial getToolMaterial()
{
    return Arrays.stream(Item.ToolMaterial.values())
                 .filter(mat -> mat.name().equalsIgnoreCase(material))
                 .findFirst().orElse(null);

}
 
Example 4
Source File: ItemPickaxeBasic.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public ItemPickaxeBasic(Item.ToolMaterial material, String name) {
    super(material);
    this.setUnlocalizedName(TofuMain.MODID+"."+name);
}
 
Example 5
Source File: ItemShovelBasic.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public ItemShovelBasic(Item.ToolMaterial material, String name) {
    super(material);
    this.setUnlocalizedName(TofuMain.MODID + "." + name);
}
 
Example 6
Source File: ItemAxeBasic.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public ItemAxeBasic(Item.ToolMaterial material, float damage, float speed, String name) {
    super(material, damage, speed);
    this.setUnlocalizedName(TofuMain.MODID + "." + name);
}
 
Example 7
Source File: WrappedToolMaterial.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
static WrappedToolMaterial of(Item.ToolMaterial material)
{
    return () -> material;
}
 
Example 8
Source File: ItemVanillaOmnitool.java    From Electro-Magic-Tools with GNU General Public License v3.0 4 votes vote down vote up
public ItemVanillaOmnitool(Item.ToolMaterial material, int maxDamage, String textureName, Item repairMaterial) {
    super(material, maxDamage, textureName);
    this.repairMaterial = repairMaterial;
    this.repairMeta = 0;
    damageAdded = 4;
}
 
Example 9
Source File: ItemVanillaOmnitool.java    From Electro-Magic-Tools with GNU General Public License v3.0 4 votes vote down vote up
public ItemVanillaOmnitool(Item.ToolMaterial material, int maxDamage, String textureName, Item repairMaterial, float damageAdded) {
    super(material, maxDamage, textureName);
    this.repairMaterial = repairMaterial;
    this.repairMeta = 0;
    this.damageAdded = damageAdded;
}
 
Example 10
Source File: ItemVanillaOmnitool.java    From Electro-Magic-Tools with GNU General Public License v3.0 4 votes vote down vote up
public ItemVanillaOmnitool(Item.ToolMaterial material, int maxDamage, String textureName, Item repairMaterial, int repairMeta) {
    super(material, maxDamage, textureName);
    this.repairMaterial = repairMaterial;
    this.repairMeta = repairMeta;
    damageAdded = 4;
}
 
Example 11
Source File: ItemVanillaOmnitool.java    From Electro-Magic-Tools with GNU General Public License v3.0 4 votes vote down vote up
public ItemVanillaOmnitool(Item.ToolMaterial material, int maxDamage, String textureName, Item repairMaterial, int repairMeta, float damageAdded) {
    super(material, maxDamage, textureName);
    this.repairMaterial = repairMaterial;
    this.repairMeta = repairMeta;
    this.damageAdded = damageAdded;
}
 
Example 12
Source File: WrappedToolMaterial.java    From customstuff4 with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Gets the material. Returns null if the material does not exist.
 */
Item.ToolMaterial getToolMaterial();