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);
}
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);
}
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;
}
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;
}
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;
}
Aggregations