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

+3 -3
View File
@@ -185,7 +185,9 @@ public class TConstruct {
MinecraftForge.EVENT_BUS.register(playerTracker);
NetworkRegistry.INSTANCE.registerGuiHandler(TConstruct.instance, proxy);
if (PHConstruct.globalDespawn != 6000) MinecraftForge.EVENT_BUS.register(new Spawntercepter());
if (PHConstruct.globalDespawn != 6000 && PHConstruct.globalDespawn != 0) {
MinecraftForge.EVENT_BUS.register(new Spawntercepter());
}
pulsar.preInit(event);
@@ -286,8 +288,6 @@ public class TConstruct {
@SubscribeEvent
public void onEntitySpawn(EntityJoinWorldEvent event) {
// return if config is zero to keep vanilla functionality
if (PHConstruct.globalDespawn == 0) return;
if (event.entity instanceof EntityItem) {
EntityItem ourGuy = (EntityItem) event.entity;
if (ourGuy.lifespan == 6000) {
@@ -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;
@@ -60,7 +60,7 @@ public class DaggerEntity extends ProjectileBase {
(EntityPlayer) shootingEntity,
movingobjectposition.entityHit,
(ToolCore) returnStack.getItem(),
PHConstruct.daggerThrowMultiplier);
PHConstruct.daggerAdditionalThrowDamage);
// super.onHitEntity(movingobjectposition);
}
@@ -78,7 +78,8 @@ public class PHConstruct {
0,
"Changes the despawn time of all items, 0 is vanilla behavior").getInt(0);
dropCanisters = config.get("Difficulty Changes", "Drop heart canisters on death", false).getBoolean(false);
daggerThrowMultiplier = config.get("Difficulty Changes", "Thrown dagger output multiplier", 1).getDouble(1);
daggerAdditionalThrowDamage = config.get("Difficulty Changes", "Additional throw damage of dagger", 0)
.getInt(0);
naturalSlimeSpawn = config.get("Mobs", "Blue Slime spawn chance", 1, "Set to 0 to disable").getInt(1);
@@ -438,7 +439,7 @@ public class PHConstruct {
public static boolean indestructible;
public static int globalDespawn;
public static boolean dropCanisters;
public static double daggerThrowMultiplier;
public static int daggerAdditionalThrowDamage;
// Smeltery Output Modification
public static double ingotsPerOre;