You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Minecraft version - 1.7.10
Tinkers' Construct version - 1.8.2.build887
Forge version/build - 10.13.2.1230
I am creating an addon mod for tinkers construct. As part of it I wanted to create a new modifier which is going to only do damage to certain mobs.
My class (which extends ActiveToolMod) overrides method attackDamage(...) and returns a different damage value increment depending on the type of entity (and the attackDamage() method returns this value). Whilst testing the code I discovered that the modDamage I return doesn't take effect because the value is not added to the overall damage value. This is because of what looks like a bug in the code below. This is the current code:
int modDamage = 0;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
modDamage = mod.attackDamage(modDamage, damage, tool, stack.getTagCompound(), toolTags, stack, living, entity);
}
damage += modDamage;
return damage;
}
I think the line:
damage += modDamage;
needs to be moved within the for loop (which loops over the activeModifiers) so that every added modifier can add to the overall damage value.
Thanks
The text was updated successfully, but these errors were encountered:
I went with the current API since otherwise it would break existing things.. if they exist.
Just use the passed damage as base and add your own onto it and return it.
Minecraft version - 1.7.10
Tinkers' Construct version - 1.8.2.build887
Forge version/build - 10.13.2.1230
I am creating an addon mod for tinkers construct. As part of it I wanted to create a new modifier which is going to only do damage to certain mobs.
My class (which extends ActiveToolMod) overrides method attackDamage(...) and returns a different damage value increment depending on the type of entity (and the attackDamage() method returns this value). Whilst testing the code I discovered that the modDamage I return doesn't take effect because the value is not added to the overall damage value. This is because of what looks like a bug in the code below. This is the current code:
tconstruct.library.tools.AbilityHelper.calcDamage(.....) {
// more code .....
int modDamage = 0;
for (ActiveToolMod mod : TConstructRegistry.activeModifiers)
{
modDamage = mod.attackDamage(modDamage, damage, tool, stack.getTagCompound(), toolTags, stack, living, entity);
}
damage += modDamage;
}
I think the line:
damage += modDamage;
needs to be moved within the for loop (which loops over the activeModifiers) so that every added modifier can add to the overall damage value.
Thanks
The text was updated successfully, but these errors were encountered: