static void Prefix(SeaMoth __instance) { // If we have the SeamothThermalModule equipped. var count = __instance.modules.GetCount(SeamothModule.SeamothThermalModule); if (count > 0) { // Evaluate the energy to add based on temperature var temperature = __instance.GetTemperature(); var energyToAdd = Main.ExosuitThermalReactorCharge.Evaluate(temperature); // Add the energy by invoking private method using Reflection. AddEnergyMethod.Invoke(__instance, new object[] { energyToAdd *Time.deltaTime *(count * count) }); } }