Search in sources :

Example 1 with ToolProperty

use of gregtech.api.unification.material.properties.ToolProperty in project GregTech by GregTechCEu.

the class TurbineRotorBehavior method getPartMaxDurability.

// TODO rework rotor stats once material stats are also reworked
@Override
public int getPartMaxDurability(ItemStack itemStack) {
    Material material = getPartMaterial(itemStack);
    ToolProperty property = material.getProperty(PropertyKey.TOOL);
    return property == null ? -1 : 800 * (int) Math.pow(property.getToolDurability(), 0.65);
}
Also used : Material(gregtech.api.unification.material.Material) ToolProperty(gregtech.api.unification.material.properties.ToolProperty)

Example 2 with ToolProperty

use of gregtech.api.unification.material.properties.ToolProperty in project GregTech by GregTechCEu.

the class TurbineRotorBehavior method getRotorPower.

public int getRotorPower(ItemStack stack) {
    Material material = getPartMaterial(stack);
    ToolProperty property = material.getProperty(PropertyKey.TOOL);
    return property == null ? -1 : (int) (40 + property.getToolAttackDamage() * 30);
}
Also used : Material(gregtech.api.unification.material.Material) ToolProperty(gregtech.api.unification.material.properties.ToolProperty)

Example 3 with ToolProperty

use of gregtech.api.unification.material.properties.ToolProperty in project GregTech by GregTechCEu.

the class ToolMetaItem method getMaxItemDamage.

@Override
public int getMaxItemDamage(ItemStack itemStack) {
    T metaToolValueItem = getItem(itemStack);
    if (metaToolValueItem != null) {
        NBTTagCompound toolTag = getToolStatsTag(itemStack);
        Material toolMaterial = getToolMaterial(itemStack);
        IToolStats toolStats = metaToolValueItem.getToolStats();
        int materialDurability = 0;
        if (toolTag != null && toolTag.hasKey("MaxDurability")) {
            materialDurability = toolTag.getInteger("MaxDurability");
        } else if (toolMaterial != null) {
            ToolProperty prop = toolMaterial.getProperty(PropertyKey.TOOL);
            if (prop != null)
                materialDurability = prop.getToolDurability();
            else
                return 0;
        }
        float multiplier = toolStats.getMaxDurabilityMultiplier(itemStack);
        return (int) (materialDurability * multiplier);
    }
    return 0;
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Material(gregtech.api.unification.material.Material) ToolProperty(gregtech.api.unification.material.properties.ToolProperty)

Example 4 with ToolProperty

use of gregtech.api.unification.material.properties.ToolProperty in project GregTech by GregTechCEu.

the class ToolMetaItem method getToolAttackDamage.

public float getToolAttackDamage(ItemStack itemStack) {
    T metaToolValueItem = getItem(itemStack);
    if (metaToolValueItem != null) {
        NBTTagCompound toolTag = getToolStatsTag(itemStack);
        Material toolMaterial = getToolMaterial(itemStack);
        IToolStats toolStats = metaToolValueItem.getToolStats();
        float attackDamage = 0;
        if (toolTag != null && toolTag.hasKey("AttackDamage")) {
            attackDamage = toolTag.getFloat("AttackDamage");
        } else if (toolTag != null && toolTag.hasKey("HarvestLevel")) {
            attackDamage = toolTag.getInteger("HarvestLevel");
        } else if (toolMaterial != null) {
            ToolProperty prop = toolMaterial.getProperty(PropertyKey.TOOL);
            if (prop != null)
                attackDamage = prop.getToolAttackDamage();
            else
                return 0;
        }
        float baseAttackDamage = toolStats.getBaseDamage(itemStack);
        return baseAttackDamage + attackDamage;
    }
    return 0;
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Material(gregtech.api.unification.material.Material) ToolProperty(gregtech.api.unification.material.properties.ToolProperty)

Example 5 with ToolProperty

use of gregtech.api.unification.material.properties.ToolProperty in project GregTech by GregTechCEu.

the class ToolMetaItem method getToolDigSpeed.

public float getToolDigSpeed(ItemStack itemStack) {
    T metaToolValueItem = getItem(itemStack);
    if (metaToolValueItem != null) {
        NBTTagCompound toolTag = getToolStatsTag(itemStack);
        Material toolMaterial = getToolMaterial(itemStack);
        IToolStats toolStats = metaToolValueItem.getToolStats();
        float toolSpeed = 0;
        if (toolTag != null && toolTag.hasKey("DigSpeed")) {
            toolSpeed = toolTag.getFloat("DigSpeed");
        } else if (toolMaterial != null) {
            ToolProperty prop = toolMaterial.getProperty(PropertyKey.TOOL);
            if (prop != null)
                toolSpeed = prop.getToolSpeed();
            else
                return 0;
        }
        float multiplier = toolStats.getDigSpeedMultiplier(itemStack);
        return toolSpeed * multiplier;
    }
    return 0;
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Material(gregtech.api.unification.material.Material) ToolProperty(gregtech.api.unification.material.properties.ToolProperty)

Aggregations

Material (gregtech.api.unification.material.Material)6 ToolProperty (gregtech.api.unification.material.properties.ToolProperty)6 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3