Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug regarding adding new modifiers (in an addon mod) #1398

Closed
kharalanova opened this issue Feb 13, 2015 · 2 comments
Closed

Possible bug regarding adding new modifiers (in an addon mod) #1398

kharalanova opened this issue Feb 13, 2015 · 2 comments

Comments

@kharalanova
Copy link

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;

    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

@bonii-xx
Copy link
Contributor

Not exactly, you get the current bonus damage and can add your own... or substract damage. It's a bit weird.
However https://github.com/SlimeKnights/TinkersConstruct/blob/master/src/main/java/tconstruct/tools/TActiveOmniMod.java#L254 seems to implement it incorrectly so currently there's no way to have both stack correctly. I'll think on which way I like better to fix it.

bonii-xx added a commit that referenced this issue Feb 14, 2015
…ge (although it should always be calculated first) #1398
@bonii-xx
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants