Revert signature changes of public methods that caused crashes (#74)

* restore previous public method signature to prevent crash

* don't register the event if vanilla config

* revert signature changes

* Restore original calculation logic

---------

Co-authored-by: OneEyeMaker <[email protected]>
This commit is contained in:
AlexdoruandOneEyeMaker authored and GitHub committed 2023-02-13 16:34:38 +01:00
1 parent 3e2ba6ac16
commit 50bd690204
4 files changed
+13 -12

No files matched your search

@@ -62,7 +62,7 @@ public class AbilityHelper {
}
public static boolean onLeftClickEntity(ItemStack stack, EntityLivingBase player, Entity entity, ToolCore tool,
double damageFactor) {
int baseDamage) {
if (entity != null && player != null && entity.canAttackWithItem() && stack.hasTagCompound()) {
if (!entity.hitByEntity(player)) // can't attack this entity
{
@@ -75,8 +75,8 @@ public class AbilityHelper {
float stoneboundDamage = (float) Math.log(durability / 72f + 1) * -2 * stonebound;
int damage = calcDamage(player, entity, stack, tool, toolTags, damageFactor);
float knockback = calcKnockback(player, entity, stack, tool, toolTags);
int damage = calcDamage(player, entity, stack, tool, toolTags, baseDamage);
float knockback = calcKnockback(player, entity, stack, tool, toolTags, baseDamage);
float enchantDamage = 0;
@@ -196,7 +196,7 @@ public class AbilityHelper {
}
public static int calcDamage(Entity user, Entity entity, ItemStack stack, ToolCore tool, NBTTagCompound toolTags,
double damageFactor) {
int baseDamage) {
EntityLivingBase living = user instanceof EntityLivingBase ? (EntityLivingBase) user : null;
int damage = toolTags.getInteger("Attack");
@@ -241,13 +241,13 @@ public class AbilityHelper {
}
damage += modDamage;
damage *= damageFactor;
damage += baseDamage;
return damage;
}
public static float calcKnockback(Entity user, Entity entity, ItemStack stack, ToolCore tool,
NBTTagCompound toolTags) {
NBTTagCompound toolTags, int baseDamage) {
if (user == null) return 0;
float knockback = 0;