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

The following examples show how to use net.minecraft.item.Item#ToolMaterial . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: Sakura_mod   File: ItemKotachi.java    License: 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 Project: Sakura_mod   File: ItemKatana.java    License: 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
@Override
public Item.ToolMaterial getToolMaterial()
{
    return Arrays.stream(Item.ToolMaterial.values())
                 .filter(mat -> mat.name().equalsIgnoreCase(material))
                 .findFirst().orElse(null);

}
 
Example 4
Source Project: TofuCraftReload   File: ItemPickaxeBasic.java    License: 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 Project: TofuCraftReload   File: ItemShovelBasic.java    License: 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 Project: TofuCraftReload   File: ItemAxeBasic.java    License: 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
static WrappedToolMaterial of(Item.ToolMaterial material)
{
    return () -> material;
}
 
Example 8
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
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
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
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
/**
 * Gets the material. Returns null if the material does not exist.
 */
Item.ToolMaterial getToolMaterial();